Пример #1
0
 /**
  * Perform any setup needed on each returned object.
  * Create, prepare and set the entry for each comment.
  * @see _make_entry()
  * @see _prepare_entry()
  * @param COMMENT $obj
  * @access private
  */
 protected function _prepare_object($obj)
 {
     parent::_prepare_object($obj);
     $entry = $this->_make_entry();
     $this->_prepare_entry($entry);
     $obj->set_entry($entry);
 }
 /**
  * Prepare security- and filter-based restrictions.
  * @access private
  */
 protected function _prepare_restrictions()
 {
     parent::_prepare_restrictions();
     $this->_calculated_restrictions[] = 'att.object_id = ' . $this->_host->id;
 }
 /**
  * @return string
  * @param string $calculated_filter
  * @access private
  */
 protected function _filter_restriction($calculated_filter)
 {
     $Result = parent::_filter_restriction($calculated_filter);
     /* If the user can't see invisible objects, expand the default
      * query to include not only all objects that pass the filter, but also
      * all unpublished objects that the user owns. 
      */
     if (($calculated_filter & Invisible) == 0 && ($this->_filter & Unpublished) == Unpublished) {
         if ($this->_filter == All) {
             $unpublished_filter = $this->_filter & ~Deleted | Invisible;
             $expected_state = Unpublished;
         } else {
             $unpublished_filter = $this->_filter;
             $expected_state = $this->_filter;
         }
         $tbl = $this->alias;
         $Result = "({$Result}) OR (({$tbl}.state & {$unpublished_filter} = " . $expected_state . ") AND ({$tbl}.owner_id = {$this->login->id}))";
     }
     return $Result;
 }
 /**
  * Prepare security- and filter-based restrictions.
  * @access private
  */
 protected function _prepare_restrictions()
 {
     parent::_prepare_restrictions();
     $this->_calculated_restrictions[] = 'bra.folder_id = ' . $this->_folder->id;
 }