/** * Carries out the specified action */ function render() { // get all the link categories but we have to respect the order that the user asked $order = $this->getValue("showOrder"); $linkCategories = new MyLinksCategories(); $blogLinkCategories = $linkCategories->getMyLinksCategories($this->_blogInfo->getId(), $order); $this->notifyEvent(EVENT_LINK_CATEGORIES_LOADED, array("linkcategories" => &$blogLinkCategories)); // put the data in the view $this->setValue("linkcategories", $blogLinkCategories); parent::render(); }
function render() { // get all the link categories $blogSettings = $this->_blogInfo->getSettings(); $linkCategoriesOrder = $blogSettings->getValue("link_categories_order", MYLINKS_CATEGORIES_NO_ORDER); // get the link categories $linkCategories = new MyLinksCategories(); $blogLinkCategories = $linkCategories->getMyLinksCategories($this->_blogInfo->getId(), $linkCategoriesOrder, $this->_page, DEFAULT_ITEMS_PER_PAGE); // get the total number of link categories $numLinkCategories = $linkCategories->getNumMyLinksCategories($this->_blogInfo->getId()); // throw the event $this->notifyEvent(EVENT_LINK_CATEGORIES_LOADED, array("linkcategories" => &$blogLinkCategories)); // create the pager $pager = new Pager("?op=editLinkCategories&page=", $this->_page, $numLinkCategories, DEFAULT_ITEMS_PER_PAGE); // create the view and fill the template context $this->setValue("linkcategories", $blogLinkCategories); $this->setValue("pager", $pager); // transfer control to the parent class parent::render(); }
/** * Carries out the specified action */ function perform() { // fetch all the link categories $blogSettings = $this->_blogInfo->getSettings(); $linkCategoriesOrder = $blogSettings->getValue("link_categories_order", MYLINKS_CATEGORIES_NO_ORDER); $linkCategories = new MyLinksCategories(); $blogLinkCategories = $linkCategories->getMyLinksCategories($this->_blogInfo->getId(), $linkCategoriesOrder); // if there is none, we should not be allowed to add any link! if (empty($blogLinkCategories)) { $this->_view = new AdminTemplatedView($this->_blogInfo, "newlinkcategory"); $this->_view->setErrorMessage($this->_locale->tr("error_must_have_one_link_category")); $this->setCommonData(); return false; } $this->notifyEvent(EVENT_LINK_CATEGORIES_LOADED, array("linkcategories" => &$blogLinkCategories)); // else, put that in the template and continue $this->_view = new AdminNewLinkView($this->_blogInfo); $this->setCommonData(); // better to return true if everything fine return true; }
/** * Carries out the specified action */ function render() { // get the parameters $order = $this->getValue("showOrder"); $categoryId = $this->getValue("showCategory"); // get all the links and throw the event $links = new MyLinks(); $blogLinks = $links->getLinks($this->_blogInfo->getId(), $categoryId, $this->_page, DEFAULT_ITEMS_PER_PAGE); $this->notifyEvent(EVENT_LINKS_LOADED, array("links" => &$blogLinks)); // get the number of links $numLinks = $links->getNumLinks($this->_blogInfo->getId(), $categoryId); // get all the link categories but we have to respect the order that the user asked $linkCategories = new MyLinksCategories(); $blogLinkCategories = $linkCategories->getMyLinksCategories($this->_blogInfo->getId(), $order); $this->notifyEvent(EVENT_LINK_CATEGORIES_LOADED, array("linkcategories" => &$blogLinkCategories)); // prepare the pager $pager = new Pager("?op=editLinks&showCategory={$categoryId}&page=", $this->_page, $numLinks, DEFAULT_ITEMS_PER_PAGE); // put the data in the view $this->setValue("links", $blogLinks); $this->setValue("linkscategories", $blogLinkCategories); $this->setValue("currentcategory", $categoryId); $this->setValue("pager", $pager); parent::render(); }
/** * Retrieves the links * * @private */ function _getLinkCategories() { $blogSettings = $this->_blogInfo->getSettings(); $linkCategoriesOrder = $blogSettings->getValue('link_categories_order', MYLINKS_CATEGORIES_NO_ORDER); $myLinksCategories = new MyLinksCategories(); $blogLinksCategories = $myLinksCategories->getMyLinksCategories($this->_blogInfo->getId(), $linkCategoriesOrder); $this->notifyEvent(EVENT_LINK_CATEGORIES_LOADED, array('linkcategories' => &$blogLinksCategories)); return $blogLinksCategories; }