/**
  * Set the parent element reference.
  *
  * @param Element $element The parent element.
  */
 public function __construct($element = null)
 {
     parent::__construct();
     if (!is_null($element)) {
         // Element reference.
         $this->element_id = $element->id;
         // Element identifier.
         $this->slug = $element->id;
         // Pubilc-facing label.
         $this->label = $element->name;
     }
 }
示例#2
0
 /**
  * Load viewer properties when instantiating class
  *
  * @param object the database object, defaults to standard Omeka db
  * @return null
  */
 public function __construct($db = null)
 {
     parent::__construct($db);
     if (!empty($this->viewer)) {
         $this->setViewerByName($this->viewer);
     }
     try {
         $this->_item = get_current_record('Item');
     } catch (Exception $e) {
         //ignore for now
     }
 }
 /**
  * This creates the NeatlineFeature object.
  *
  * @param $item         Omeka_Record The Omeka item associated with this 
  * feature.
  * @param $element_text ElementText The Omeka element text that this is 
  * associated with. If not given, it just takes the first element text for 
  * the Coverage field.
  *
  * @return NeatlineFeature $this
  * @author Eric Rochester <*****@*****.**>
  **/
 public function __construct($item = null, $element_text = null)
 {
     parent::__construct();
     if (!is_null($item)) {
         $this->item_id = $item->id;
     }
     if (!is_null($element_text)) {
         $this->element_text = $element_text->id;
     }
     // Default values.
     if (is_null($this->is_map)) {
         $this->is_map = false;
     }
     if (is_null($this->added)) {
         $this->added = date('c');
     }
 }