Esempio n. 1
0
 private function addStackToCategory(\Concrete\Core\Page\Page $parent, $name, $type = 0)
 {
     $data = array();
     $data['name'] = $name;
     if (!$name) {
         $data['name'] = t('No Name');
     }
     $pagetype = PageType::getByHandle(STACKS_PAGE_TYPE);
     $page = $parent->add($pagetype, $data);
     // we have to do this because we need the area to exist before we try and add something to it.
     Area::getOrCreate($page, STACKS_AREA_NAME);
     // finally we add the row to the stacks table
     $db = Database::connection();
     $stackCID = $page->getCollectionID();
     $v = array($name, $stackCID, $type);
     $db->Execute('insert into Stacks (stName, cID, stType) values (?, ?, ?)', $v);
     $stack = static::getByID($stackCID);
     return $stack;
 }
Esempio n. 2
0
 /**
  * Adds a new page of a certain type, using a passed associate array to setup value. $data may contain any or all of the following:
  * "uID": User ID of the page's owner
  * "pkgID": Package ID the page belongs to
  * "cName": The name of the page
  * "cHandle": The handle of the page as used in the path
  * "cDatePublic": The date assigned to the page.
  *
  * @param \Concrete\Core\Page\Type\Type $pt
  * @param array $data
  *
  * @return page
  **/
 public function add($pt, $data, $template = false)
 {
     return parent::add($pt, $data, $template);
 }