public static function getChildPage($cID, $ctHandle)
 {
     $pl = new PageList();
     //Filters
     $pl->filterByParentID($cID);
     $pl->filterByPageTypeHandle($ctHandle);
     //Get the page List Results
     $res = $pl->get(1);
     return $res[0];
 }
示例#2
0
文件: comments.php 项目: baardev/lbtb
 public function getCommentsByParentIDs($IDs)
 {
     $db = Loader::db();
     $child_pages = array();
     $blogList = new PageList();
     $blogList->sortBy('cDateAdded', 'desc');
     //$blogList->filter(false,"(CHAR_LENGTH(cv.cvName) > 4 OR cv.cvName NOT REGEXP '^[0-9]')");
     $blogList->filter(false, "ak_is_canonical_page < 1");
     if (!$IDs) {
         $r = $db->EXECUTE("SELECT DISTINCT cnv.cID FROM ConversationMessages cnvm LEFT JOIN Conversations cnv ON cnvm.cnvID = cnv.cnvID ORDER BY cnvMessageDateCreated DESC");
         while ($row = $r->fetchrow()) {
             $IDs[] = $row['cID'];
         }
     }
     if (is_array($IDs)) {
         foreach ($IDs as $id) {
             if ($fs) {
                 $fs .= ' OR ';
             }
             $path = Page::getByID($id)->getCollectionPath() . '/';
             $fs .= "pp.cPath LIKE '{$path}%'";
         }
         $blogList->filter(false, "({$fs})");
     }
     //$blogList->filter(false,"(CHAR_LENGTH(cv.cvName) > 4 OR cv.cvName NOT REGEXP '^[0-9]')");
     $blogList->filter(false, "ak_is_canonical_page < 1");
     $blogResults = $blogList->get();
     foreach ($blogResults as $result) {
         $child_pages[] = $result->getCollectionID();
     }
     $filter = '';
     if ($this->request('comment_todo')) {
         $this->set('comment_todo', $this->request('comment_todo'));
         switch ($this->request('comment_todo')) {
             case 'approves':
                 $filter = "WHERE cnvm.cnvIsMessageApproved = 1";
                 break;
             case 'unapproves':
                 $filter = "WHERE cnvm.cnvIsMessageDeleted = 1";
                 break;
         }
     }
     $r = $db->EXECUTE("SELECT * FROM ConversationMessages cnvm LEFT JOIN Conversations cnv ON cnvm.cnvID = cnv.cnvID {$filter} ORDER BY cnvMessageDateCreated DESC");
     $comments = array();
     while ($row = $r->fetchrow()) {
         $ccObj = Page::getByID($row['cID']);
         $pID = $ccObj->getCollectionID();
         //var_dump($pID.' - '.print_r($child_pages));
         if (in_array($pID, $child_pages)) {
             $comments[] = $row;
         }
     }
     return $comments;
 }
示例#3
0
文件: publish.php 项目: baardev/lbtb
 public function view()
 {
     $html = Loader::helper('html');
     // $this->addHeaderItem($html->css('css/font-awesome.css','problog'));
     // $this->addHeaderItem($html->css('css/seo_tools.css','problog'));
     // $this->addHeaderItem($html->css('app.css'));
     // $this->addHeaderItem($html->css('redactor.css'));
     // $this->addHeaderItem($html->css('jquery-ui.css'));
     // $this->addHeaderItem($html->javascript('jquery.js'));
     // $this->addHeaderItem('<script type="text/javascript"> var $ = jQuery.noConflict(); </script>');
     // $this->addHeaderItem($html->javascript('legacy.js'));
     // $this->addHeaderItem($html->javascript('jquery-ui.js'));
     // $this->addHeaderItem($html->javascript('events.js'));
     //$this->addHeaderItem($html->javascript('app.js'));
     //$this->addHeaderItem($html->javascript('redactor.js'));
     // $this->addFooterItem($html->javascript('file-manager.js'));
     // $this->addFooterItem($html->javascript('seo_tools.js','problog'));
     $blogify = Loader::helper('blogify');
     $settings = $blogify->getBlogSettings();
     $blogSectionList = new PageList();
     $blogSectionList->filter(false, "ak_blog_section = 1");
     $blogSectionList->sortBy('cvName', 'asc');
     $tmpSections = $blogSectionList->get();
     $sections = array();
     foreach ($tmpSections as $_c) {
         $spk = new AddSubpagePageKey();
         $pp = $spk->validate($_c);
         if ($pp) {
             $pt = $p;
             $sections[$_c->getCollectionID()] = $_c->getCollectionName();
         }
     }
     $ctArray = CollectionType::getList('');
     $pageTypes = array();
     foreach ($ctArray as $ct) {
         $spk = new AddSubpagePageKey();
         $pp = $spk->validate($ct);
         if ($pp) {
             $pageTypes[$ct->getPageTypeID()] = $ct->getPageTypeName();
         }
     }
     if ($_REQUEST['postID']) {
         $keys = array_keys($sections);
         $keys[] = -1;
         $current_page = Page::getByID($_REQUEST['postID']);
         $date = $current_page->getCollectionDatePublic();
         $canonical_parent_id = $blogify->getCanonicalParent($date, $current_page);
         $cParentID = $canonical_parent_id;
         if (in_array($canonical_parent_id, $keys)) {
             $this->blog = $current_page;
         }
     }
     if (is_object($this->blog)) {
         $blogTitle = $this->blog->getCollectionName();
         $blogDescription = $this->blog->getCollectionDescription();
         $blogDate = $this->blog->getCollectionDatePublic();
         $ctID = $this->blog->getCollectionTypeID();
         $blogBody = '';
         $eb = $this->blog->getBlocks('Main');
         if (is_object($eb[0])) {
             $blogBody = $eb[0]->getInstance()->getContent();
         }
         echo "<div class=\"event_warning\"><span class=\"tooltip icon edit\"></span> You are now editing <b><u>{$blogTitle}</u></b></div>";
         $task = 'editthis';
         $buttonText = t('Update Blog Entry');
         $title = 'Update';
     } else {
         $task = 'addthis';
         $buttonText = t('Add Blog Entry');
         $title = 'Add';
     }
     $this->set('blog', $this->blog);
     $this->set('blogTitle', $blogTitle);
     $this->set('blogDescription', $blogDescription);
     $this->set('blogBody', $blogBody);
     $this->set('sections', $sections);
     $this->set('pageTypes', $pageTypes);
     $this->set('buttonText', $buttonText);
 }
示例#4
0
 /**
  * @deprecated
  */
 public function get()
 {
     return parent::get();
 }
示例#5
0
文件: blogify.php 项目: baardev/lbtb
 protected function loadblogSections()
 {
     $blogSectionList = new PageList();
     $blogSectionList->setItemsPerPage($this->num);
     $blogSectionList->filterByBlogSection(1);
     $blogSectionList->sortBy('cvName', 'asc');
     $tmpSections = $blogSectionList->get();
     $sections = array();
     foreach ($tmpSections as $_c) {
         $sections[$_c->getCollectionID()] = $_c->getCollectionName();
     }
     $this->sections = $sections;
 }
示例#6
0
 function get_forum_categories()
 {
     $pl = new PageList();
     $pl->sortByName();
     $pl->filterByAttribute('forum_category', true);
     return $pl->get();
 }
示例#7
0
 function get_forum_pages()
 {
     $c = Page::getCurrentPage();
     if ($c->getPageTypeHandle() == 'forum_post') {
         $parentCID = $c->getCollectionParentID();
         $forumPages = array(Page::getByID($parentCID));
     } else {
         $parentCID = $c->getCollectionID();
         if ($parentCID < 1 || $parentCID == false) {
             $parentCID = 1;
         }
         $fpl = new PageList();
         $fpl->sortByDisplayOrder();
         $fpl->filterByParentID($parentCID);
         $fpl->filterByAttribute('forum_category', true);
         $forumPages = $fpl->get();
         if (count($forumPages) < 2) {
             if ($c->getAttribute('forum_category')) {
                 $forumPages = array($c);
             }
         }
     }
     return $forumPages;
 }
示例#8
0
文件: add_blog.php 项目: baardev/lbtb
 /**
  * render Add Blog dialog
  */
 public function render()
 {
     $this->requireAsset('redactor');
     $this->requireAsset('core/file-manager');
     $blogify = Loader::helper('blogify');
     $settings = $blogify->getBlogSettings();
     $blogSectionList = new PageList();
     $blogSectionList->filter(false, "ak_blog_section = 1");
     $blogSectionList->sortBy('cvName', 'asc');
     $tmpSections = $blogSectionList->get();
     $sections = array();
     foreach ($tmpSections as $_c) {
         $pt = CollectionType::getByID($_c->getCollectionTypeID());
         $cmp = new \Permissions($pt);
         $pp = $cmp->canAddPageType();
         if ($pp) {
             $sections[$_c->getCollectionID()] = $_c->getCollectionName();
         }
     }
     $ctArray = PageTemplate::getList('');
     $pageTemplates = array();
     foreach ($ctArray as $ct) {
         $pms = new AddSubpagePageKey($ct);
         $pp = $pms->validate();
         if ($pp) {
             $pageTemplates[$ct->getPageTemplateID()] = $ct->getPageTemplateName();
         }
     }
     if ($_REQUEST['postID']) {
         $keys = array_keys($sections);
         $keys[] = -1;
         $current_page = Page::getByID($_REQUEST['postID']);
         $date = $current_page->getCollectionDatePublic();
         $canonical_parent_id = $blogify->getCanonicalParent($date, $current_page);
         $cParentID = $canonical_parent_id;
         if (in_array($canonical_parent_id, $keys)) {
             $this->blog = $current_page;
         }
     }
     if (is_object($this->blog)) {
         $blogTitle = $this->blog->getCollectionName();
         $blogDescription = $this->blog->getCollectionDescription();
         $blogDate = $this->blog->getCollectionDatePublic();
         $ptID = $this->blog->getPageTemplateID();
         $blogBody = '';
         $eb = $this->blog->getBlocks('Main');
         foreach ($eb as $b) {
             if ($b->getBlockTypeHandle() == 'content' || $b->getBlockTypeHandle() == 'core_page_type_composer_control_output') {
                 $blogBody = $b->getInstance()->getContent();
             }
         }
         echo "<div class=\"alert alert-success\"><span class=\"tooltip icon edit\"></span> " . t('You are now editing') . " <b><u>{$blogTitle}</u></b></div>";
         $task = 'editthis';
         $buttonText = t('Update Blog Entry');
         $title = 'Update';
     } else {
         $task = 'addthis';
         $buttonText = t('Add Blog Entry');
         $title = 'Add';
     }
     Loader::PackageElement('tools/add_blog', 'problog', array('blog' => $this->blog, 'blogTitle' => $blogTitle, 'blogDescription' => $blogDescription, 'blogBody' => $blogBody, 'sections' => $sections, 'pageTemplates' => $pageTemplates, 'buttonText' => $buttonText, 'ptID' => $ptID, 'settings' => $settings));
 }