Пример #1
0
 function getDashboardObject()
 {
     $ret = parent::getDashboardObject();
     $ret["mimeType"] = $this->getTypeString();
     return $ret;
 }
Пример #2
0
 /**
  * This function will return content of specific searchable column. 
  * 
  * It uses inherited behaviour for all columns except for `filecontent`. In case of this column function will return 
  * file content if file type is marked as searchable (text documents, office documents etc).
  *
  * @param string $column_name
  * @return string
  */
 function getSearchableColumnContent($column_name)
 {
     if ($column_name == 'filecontent') {
         $file_type = $this->getFileType();
         // Unknown type or type not searchable
         if (!$file_type instanceof FileType || !$file_type->getIsSearchable()) {
             return null;
         }
         // if
         $content = $this->getFileContent();
         if (strlen($content) < MAX_SEARCHABLE_FILE_SIZE) {
             return $content;
         }
         // if
     } else {
         return parent::getSearchableColumnContent($column_name);
     }
     // if
 }
 /**
  * 
  * 
  */
 function addToSharingTable()
 {
     // if classified or not belongs to an email
     $member_ids = array();
     $members = $this->getMembers();
     foreach ($members as $m) {
         $d = $m->getDimension();
         if ($d instanceof Dimension && $d->getIsManageable()) {
             $member_ids[] = $m->getId();
         }
     }
     if ($this->getMailId() == 0 || count($member_ids) > 0) {
         $revisions = $this->getRevisions();
         if (is_array($revisions)) {
             foreach ($revisions as $revision) {
                 $revision->addToSharingTable();
             }
         }
         parent::addToSharingTable();
     } else {
         // if not classified and belongs to an email
         $mail = MailContents::findById($this->getMailId());
         if ($mail instanceof MailContent) {
             DB::execute("DELETE FROM " . TABLE_PREFIX . "sharing_table WHERE object_id=" . $this->getId());
             $macs = MailAccountContacts::findAll(array('conditions' => array('`account_id` = ?', $mail->getAccountId())));
             foreach ($macs as $mac) {
                 $c = Contacts::findById($mac->getContactId());
                 if ($c instanceof Contact) {
                     $values = "(" . $c->getPermissionGroupId() . "," . $this->getId() . ")";
                     DB::execute("INSERT INTO " . TABLE_PREFIX . "sharing_table (group_id, object_id) VALUES {$values} ON DUPLICATE KEY UPDATE group_id=group_id;");
                 }
             }
         }
     }
 }
Пример #4
0
 /**
  * Return object path (location of the object)
  *
  * @param void
  * @return string
  */
 function getObjectPath()
 {
     $f = $this->getFolder();
     if (is_null($f)) {
         return parent::getObjectPath();
     }
     return $f->getObjectPath();
 }
Пример #5
0
 /**
  * 
  * @author Ignacio Vazquez - elpepe.uy@gmail.com
  */
 function addToSharingTable()
 {
     $revisions = $this->getRevisions();
     if (is_array($revisions)) {
         foreach ($revisions as $revision) {
             $revision->addToSharingTable();
         }
     }
     parent::addToSharingTable();
 }