Example #1
0
 static function wikiSave()
 {
     global $page;
     //We add these to a stack that needs to be sent, rather than just sending all with the view event
     $me = new self();
     foreach ($me->getItems() as $item) {
         (new Tracker_Query('Wiki Attributes'))->byName()->replaceItem(array('Page' => $page, 'Attribute' => $item->pastlink->text, 'Value' => 'true', 'Type' => 'PastLink Send'));
     }
 }
Example #2
0
 /**
  * Renders a folder tree
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public static function renderTree($uri)
 {
     // Get the place data
     $place = self::getPlace($uri);
     // Determines if this is a local type or other remote sources
     $type = self::getSourceType($place->id);
     // Render media manager
     $mediaManager = new self($type);
     $folder = $mediaManager->getItems($uri);
     $template = EB::template();
     $template->set('place', $place);
     $template->set('folder', $folder);
     $html = $template->output('site/mediamanager/tree');
     return $html;
 }
Example #3
0
 /**
  * @param array $array
  * @param bool $strict
  * @return Collection
  * @throws FromArrayCompilationException
  */
 public static function fromArray(array $array, $strict = true)
 {
     $href = '';
     $version = '1.0';
     if (array_key_exists('href', $array)) {
         $href = $array['href'];
     } elseif ($strict) {
         throw new MissingArgumentException('href');
     }
     if (array_key_exists('version', $array)) {
         $version = $array['version'];
     }
     $collection = new self($href, $version);
     if (array_key_exists('links', $array)) {
         if (!is_array($array['links'])) {
             throw new ExpectedArrayException('links', gettype($array['links']));
         }
         try {
             foreach ($array['links'] as $key => $linkArray) {
                 if (!is_array($linkArray)) {
                     throw new ExpectedArrayException($key, gettype($linkArray));
                 }
                 try {
                     $collection->getLinks()->add(Link::fromArray($linkArray, $strict));
                 } catch (FromArrayCompilationException $e) {
                     throw new FromArrayCompilationException($key, $e->getMessage());
                 }
             }
         } catch (FromArrayCompilationException $e) {
             throw new FromArrayCompilationException('links', $e->getMessage());
         }
     }
     if (array_key_exists('items', $array)) {
         if (!is_array($array['items'])) {
             throw new ExpectedArrayException('items', gettype($array['items']));
         }
         try {
             foreach ($array['items'] as $key => $itemArray) {
                 if (!is_array($itemArray)) {
                     throw new ExpectedArrayException($key, gettype($itemArray));
                 }
                 try {
                     $collection->getItems()->add(Item::fromArray($itemArray, $strict));
                 } catch (FromArrayCompilationException $e) {
                     throw new FromArrayCompilationException($key, $e->getMessage());
                 }
             }
         } catch (FromArrayCompilationException $e) {
             throw new FromArrayCompilationException('items', $e->getMessage());
         }
     }
     if (array_key_exists('queries', $array)) {
         if (!is_array($array['queries'])) {
             throw new ExpectedArrayException('queries', gettype($array['queries']));
         }
         try {
             foreach ($array['queries'] as $key => $queryArray) {
                 if (!is_array($queryArray)) {
                     throw new ExpectedArrayException($key, gettype($queryArray));
                 }
                 try {
                     $collection->getQueries()->add(Query::fromArray($queryArray, $strict));
                 } catch (FromArrayCompilationException $e) {
                     throw new FromArrayCompilationException($key, $e->getMessage());
                 }
             }
         } catch (FromArrayCompilationException $e) {
             throw new FromArrayCompilationException('queries', $e->getMessage());
         }
     }
     if (array_key_exists('template', $array)) {
         if (!is_array($array['template'])) {
             throw new ExpectedArrayException('template', gettype($array['template']));
         }
         try {
             $collection->setTemplate(Template::fromArray($array['template'], $strict));
         } catch (FromArrayCompilationException $e) {
             throw new FromArrayCompilationException('template', $e->getMessage());
         }
     }
     if (array_key_exists('error', $array)) {
         if (!is_array($array['error'])) {
             throw new ExpectedArrayException('error', gettype($array['error']));
         }
         try {
             $collection->setError(Error::fromArray($array['error']));
         } catch (FromArrayCompilationException $e) {
             throw new FromArrayCompilationException('error', $e->getMessage());
         }
     }
     if (array_key_exists('paging', $array)) {
         if (!is_array($array['paging'])) {
             throw new ExpectedArrayException('paging', gettype($array['paging']));
         }
         try {
             $collection->setPaging(Paging::fromArray($array['paging'], $strict));
         } catch (FromArrayCompilationException $e) {
             throw new FromArrayCompilationException('paging', $e->getMessage());
         }
     }
     return $collection;
 }