Mac os x web server - 252 Part II: Developing Intranet Solutions . loadCatInfo():
252 Part II: Developing Intranet Solutions . loadCatInfo(): This method loads all attribute values into the category object from the LD_CATEGORY table by the specified category IDs. This is how it works: setCatID() is called to set the passed category ID to the current object. If no category ID is passed, the current $this->cid is taken. The $this->dbi object is used to retrieve all the attribute values of the given category from the LD_CATEGORY table. Each of the values is set to the current object so that they can be retrieved at any time using the other get methods of this class. For example $this>CAT_NAME is set to the value of the CAT_NAME of the given category. . getCategoryIDbyName(): This method returns the category ID for the given category name. It works as follows: It takes the category name as parameter. The category name is quoted using the quote() method of the $this>dbi object and inserted into the SQL statement, which is needed to retrieve the category ID. The query executes, and the resultant category ID is returned. If no result is found, it returns null. . getCategories(): This method returns all the category names along with their IDs from the LD_CATEGORY table. This is how it works: It executes a SQL query to retrieve all the field value of the LD_CATEGORY table ordered by descending CAT_ORDER. The result is stored in an array that contains the category ID and name. It returns the prepared array (or null, if the result set is empty). . getPublishers(): This method returns the publisher IDs for a given category. This is how it works: It calls setCatID() to set the passed category ID. It executes a SQL query that retrieves all the publisher IDs from the LD_CAT_PUBLISHER table for the given category ID. It stores the result of the execution in an array (unless the result set is empty), and returns the array. It returns null if the result set is empty. . getViewers(): This method returns the viewer IDs for a given category. It works as follows: It calls setCatID() to set the passed category ID. It executes a SQL query that retrieves all the viewer IDs from the LD_CAT_VIEWER table for the given category ID.