Example #1
0
 /** 
  * Returns a link to a page
  * @param Page $cObj
  * @return string $link
  */
 public function getLinkToCollection(&$cObj, $appendBaseURL = false, $ignoreUrlRewriting = false)
 {
     // basically returns a link to a collection, based on whether or we have
     // mod_rewrite enabled, and the collection has a path
     $dispatcher = '';
     if (!defined('URL_REWRITING_ALL') || URL_REWRITING_ALL == false) {
         if (!URL_REWRITING || $ignoreUrlRewriting) {
             $dispatcher = '/' . DISPATCHER_FILENAME;
         }
     }
     if ($cObj->isExternalLink() && $appendBaseURL == false) {
         $link = $cObj->getCollectionPointerExternalLink();
         return $link;
     }
     if ($cObj->getCollectionPath() != null) {
         $link = DIR_REL . $dispatcher . $cObj->getCollectionPath() . '/';
     } else {
         $_cID = $cObj->getCollectionPointerID() > 0 ? $cObj->getCollectionPointerOriginalID() : $cObj->getCollectionID();
         if ($_cID > 1) {
             $link = DIR_REL . $dispatcher . '?cID=' . $_cID;
         } else {
             $link = DIR_REL . '/';
         }
     }
     if ($appendBaseURL) {
         $link = BASE_URL . $link;
     }
     return $link;
 }
Example #2
0
 /**
  * @param \Page $c
  * @param string $arHandle
  * @return Area
  */
 public function create($c, $arHandle)
 {
     $db = Loader::db();
     $db->Replace('Areas', array('cID' => $c->getCollectionID(), 'arHandle' => $arHandle, 'arParentID' => $this->arParentID), array('arHandle', 'cID'), true);
     $this->refreshCache($c);
     $area = self::get($c, $arHandle);
     $area->rescanAreaPermissionsChain();
     return $area;
 }
Example #3
0
 public static function getList(Page $c, $filters = array('wpIsCompleted' => 0), $sortBy = 'wpDateAdded asc')
 {
     $db = Loader::db();
     $filter = '';
     foreach ($filters as $key => $value) {
         $filter .= ' and ' . $key . ' = ' . $value . ' ';
     }
     $filter .= ' order by ' . $sortBy;
     $r = $db->Execute('select wp.wpID from PageWorkflowProgress pwp inner join WorkflowProgress wp on pwp.wpID = wp.wpID where cID = ? ' . $filter, array($c->getCollectionID()));
     $list = array();
     while ($row = $r->FetchRow()) {
         $wp = PageWorkflowProgress::getByID($row['wpID']);
         if (is_object($wp)) {
             $list[] = $wp;
         }
     }
     return $list;
 }
Example #4
0
 /**
  * Get all of the blocks within the current area for a given page
  * @param Page|Collection $c
  * @return Block[]
  */
 public function getAreaBlocksArray($c)
 {
     if (is_array($this->areaBlocksArray)) {
         return $this->areaBlocksArray;
     }
     $this->cID = $c->getCollectionID();
     $this->c = $c;
     $this->areaBlocksArray = array();
     if ($this->arIsGlobal) {
         $blocks = array();
         $cp = new Permissions($c);
         if ($cp->canViewPageVersions()) {
             $c = Stack::getByName($this->arHandle);
         } else {
             $c = Stack::getByName($this->arHandle, 'ACTIVE');
         }
         if (is_object($c)) {
             $blocks = $c->getBlocks(STACKS_AREA_NAME);
             $globalArea = self::get($c, STACKS_AREA_NAME);
         }
     } else {
         $blocks = $c->getBlocks($this->arHandle);
     }
     foreach ($blocks as $ab) {
         if ($this->arIsGlobal && is_object($globalArea)) {
             $ab->setBlockAreaObject($globalArea);
         } else {
             $ab->setBlockAreaObject($this);
         }
         $this->areaBlocksArray[] = $ab;
         $this->totalBlocks++;
     }
     return $this->areaBlocksArray;
 }
 public function setPage(Page $page)
 {
     $this->cID = $page->getCollectionID();
 }
 public function setPageObject(Page $c)
 {
     $this->cID = $c->getCollectionID();
 }
Example #7
0
 public function setPageObject(Page $c)
 {
     $this->cID = $c->getCollectionPointerOriginalID() > 0 ? $c->getCollectionPointerOriginalID() : $c->getCollectionID();
 }