function AdminEditSiteBlogView($blogInfo, $editBlogInfo = null) { // fetch information about the blog we're editing if ($editBlogInfo == null) { $this->_editBlogInfo = $this->getSessionValue('editBlogInfo'); } else { $this->_editBlogInfo = $editBlogInfo; } // this stuff is a bit weird but I couldn't find a better way to do it! if ($this->_editBlogInfo) { $this->AdminTemplatedView($blogInfo, 'editblog'); $this->_error = false; $this->setSessionValue('editBlogInfo', $this->_editBlogInfo); // ... // export data to the view $this->setValue('editblog', $this->_editBlogInfo); $this->setValue('editblogsettings', $this->_editBlogInfo->getSettings()); // blog settings... $blogTemplateSet = $this->_editBlogInfo->getTemplateSet(); $this->setValue('blogTemplate', $blogTemplateSet->getName()); $ts = new TemplateSets(); // get the blog template sets $this->setValue('templates', $ts->getBlogTemplateSets($this->_editBlogInfo->getId(), true)); // and the list of locale availables $this->setValue('locales', Locales::getLocales()); $this->setValue('blogStatus', $this->_editBlogInfo->getStatus()); $this->setValue('blogStatusList', BlogStatus::getStatusList()); $blogSettings = $this->_editBlogInfo->getSettings(); $this->setValue('blogTimeOffset', $blogSettings->getValue('time_offset')); $this->setValue('blogOwner', $this->_editBlogInfo->getOwner()); $this->setValue('blogName', $this->_editBlogInfo->getBlog()); $this->setValue('blogLocale', $blogSettings->getValue("locale")); $this->setValue('blogResourcesQuota', $this->_editBlogInfo->getResourcesQuota()); // get all the users $users = new Users(); $siteUsers = $users->getAllUsers(); $this->notifyEvent(EVENT_USERS_LOADED, array('users' => &$siteUsers)); // set the blog users and the available users $blogUsers = $users->getBlogUsers($this->_editBlogInfo->getId(), false); $this->setValue('availableusers', $this->filterAvailableUsers($siteUsers, $blogUsers)); $this->setValue('blogusers', $blogUsers); $this->setValue('siteusers', $siteUsers); } else { $this->AdminTemplatedView($blogInfo, 'error'); $this->setValue('message', 'Unexpected error loading blog!'); $this->_error = true; } }
function render() { // we need to get all the blogs // get the data itself $this->_status = $this->getStatusFromRequest(); $blogs = new Blogs(); $siteBlogs = $blogs->getAllBlogs($this->_status, $this->_page, DEFAULT_ITEMS_PER_PAGE); $numBlogs = $blogs->getNumBlogs($this->_status); if (!$siteBlogs) { $siteBlogs = array(); } // throw the right event $this->notifyEvent(EVENT_BLOGS_LOADED, array("blogs" => &$siteBlogs)); // calculate the links to the different pages $pager = new Pager("?op=editSiteBlogs&status=" . $this->_status . "&page=", $this->_page, $numBlogs, DEFAULT_ITEMS_PER_PAGE); $this->setValue("siteblogs", $siteBlogs); $this->setValue("pager", $pager); $this->setValue("currentstatus", $this->_status); $this->setValue("blogstatus", BlogStatus::getStatusList(true)); // let the parent view do its job parent::render(); }
/** * @param status The status code we'd like to check * * @return Returns true if the status is valid or false otherwise */ function isValidStatus($status) { $statusList = BlogStatus::getStatusList(true); return in_array($status, $statusList); }