|
|
![]()
|
|
Home | Contact Us | Disclaimer | Privacy Policy | Copyright Statement
/* +---------------------------------------------------------------+ | Yellowpages by bugrain (www.bugrain.plus.com) | | A plugin for the e107 Website System (http://e107.org) | | Released under the terms and conditions of the | GNU General Public License (http://gnu.org). | | $Source: e:\_repository\e107_plugins/yellowpages/handlers/yellowpages_entry.php,v $ | $Revision: 1.1.2.1 $ | $Date: 2007/02/07 00:22:13 $ | $Author: Neil $ +---------------------------------------------------------------+ */ /** * Model Object for an Yellowpages Category */ class yellowpagesCategory { var $category; // An array of category field values /** * Constructor * @param $category a row from the categories table * @param $yellowpages an yellowpages object for the yellowpages that this category belongs to */ function yellowpagesCategory($category=false, $yellowpages=false) { // Set some default values $this->category["yellowpages_category_yellowpages_ids"] = $yellowpages ? $yellowpages->getId() : 0; if ($category) { $this->category = array_merge($this->category, $category); } } // Getters function getId() { return $this->category["yellowpages_category_id"]; } function getYellowpagesId() { return $this->category["yellowpages_category_yellowpages_ids"]; } function getName() { return $this->category["yellowpages_category_name"]; } function getTitle() { return $this->category["yellowpages_category_title"]; } function getDescription() { return $this->category["yellowpages_category_description"]; } function getIcon() { return $this->category["yellowpages_category_icon"]; } function getImages() { return $this->category["yellowpages_category_images"]; } function getLinkDescription() { return $this->category["yellowpages_category_link_description"]; } function getLinkURL() { return $this->category["yellowpages_category_link_url"]; } function getTemplate() { return $this->category["yellowpages_category_template"]; } function getRestrictionValue() { return $this->category["yellowpages_category_vote_restriction_value"]; } function getRestrictionField() { return $this->category["yellowpages_category_vote_restriction_field"]; } } ?> /* +---------------------------------------------------------------+ | yellowpages by bugrain (www.bugrain.plus.com) | | A plugin for the e107 Website System (http://e107.org) | | Released under the terms and conditions of the | GNU General Public License (http://gnu.org). | | $Source: e:\_repository\e107_plugins/yellowpages/handlers/yellowpages_user.php,v $ | $Revision: 1.1.2.1 $ | $Date: 2007/02/07 00:22:13 $ | $Author: Neil $ +---------------------------------------------------------------+ */ /** * Model Object for an yellowpages user * Holds information relating to the current user and what they are allowed to do in yellowpages */ class yellowpagesUser { var $user; // user data var $privs; // an array of yellowpages privilieges, index on yellowpages ID /** * Constructor * @param $yellowpagess a yellowpages object or an array of yellowpages objects */ function yellowpagesUser($yellowpagess) { if (!is_array($yellowpagess)) { $yellowpageslist[$yellowpagess->getId()] = $yellowpagess; } else { $yellowpageslist = $yellowpagess; } foreach ($yellowpageslist as $yellowpages) { $this->setViewyellowpages($yellowpages); $this->setVoteyellowpages($yellowpages); } $this->user = get_user_data(USERID); } // Setters function setViewyellowpages($yellowpages) { $this->privs[$yellowpages->getId()]["view"] = check_class($yellowpages->getViewClass()); } function setVoteyellowpages($yellowpages) { $this->privs[$yellowpages->getId()]["vote"] = check_class($yellowpages->getVoteClass()) || USERID == $yellowpages->getOwnerId(); } // Privilege checks function canViewyellowpages($yellowpagesId) { return $this->privs[$yellowpagesId]["view"]; } function canVoteyellowpages($yellowpagesId) { return $this->privs[$yellowpagesId]["vote"]; } function isRestricted($value, $field) { return ($value && $value == $this->user["user_$field"]); } } ?> /* +---------------------------------------------------------------+ | yellowpages by bugrain (www.bugrain.plus.com) | | A plugin for the e107 Website System (http://e107.org) | | Released under the terms and conditions of the | GNU General Public License (http://gnu.org). | | $Source: e:\_repository\e107_plugins/yellowpages/handlers/yellowpages_status_info.php,v $ | $Revision: 1.1.2.1 $ | $Date: 2007/02/07 00:22:13 $ | $Author: Neil $ +---------------------------------------------------------------+ */ // Status Info levels define("STATUS_INFO", "INFO"); define("STATUS_WARN", "WARN"); define("STATUS_ERROR", "ERROR"); define("STATUS_FATAL", "FATAL"); define("STATUS_DEBUG", "DEBUG"); /** * Model Object for an yellowpages error * Holds information relating to errors and warnings */ class yelpStatusInfo { var $level; // Status level var $messages; // array of messages /** * Constructor * @param $level status level, defaults to STATUS_ERROR - refer to STATUS_* constants */ function yelpStatusInfo ($level=STATUS_ERROR) { $this->level = $level; $this->messages = array(); } function getLevel() { return $this->level; } function getLevelDescription() { switch ($this->level) { case STATUS_DEBUG : { return YELP_LAN_MSG_DEBUG; } case STATUS_INFO : { return YELP_LAN_MSG_INFORMATION; } case STATUS_WARN : { return YELP_LAN_MSG_WARNING; } case STATUS_ERROR : { return YELP_LAN_MSG_ERROR; } case STATUS_FATAL : { return YELP_LAN_MSG_FATAL; } default : { return ""; } } } function getMessageCount() { return count($this->messages); } function getMessage($ix) { return $this->messages[$ix]["message"]; } function getAdditionalDetails($ix) { return $this->messages[$ix]["additional"]; } function hasAdditionalDetails($ix) { return (isset($this->messages[$ix]["additional"])); } function addMessage($message, $additionalDetails=false) { $this->messages[]["message"] = $message; if (false !== $additionalDetails) { return $this->messages[count($this->messages)-1]["additional"] = $additionalDetails; } } function addMissingMandatory($fieldName) { return $this->messages[]["message"] = $fieldName.YELP_LAN_MSG_MANDATORY; } } ?>