protected function processItem(Docman_Item $item)
 {
     $project_id = $item->getGroupId();
     $this->initializeMapping($project_id);
     $this->actions->indexCopiedItem($item);
     return true;
 }
コード例 #2
0
 function Docman_Document($data = null)
 {
     parent::__construct($data);
 }
コード例 #3
0
 /**
  * Raise item monitoring list event
  *
  * @param Docman_Item $item Locked item
  * @param String      $eventType
  * @param Array       $subscribers
  *
  * @return void
  */
 function _raiseMonitoringListEvent($item, $subscribers, $eventType)
 {
     $p = array('group_id' => $item->getGroupId(), 'item' => $item, 'listeners' => $subscribers, 'event' => $eventType);
     $this->event_manager->processEvent('plugin_docman_event_subcribers', $p);
 }
コード例 #4
0
 /**
  * Release locked item
  *
  * @param Docman_Item $item Item to lock
  *
  * @return Boolean
  */
 function unlock($item)
 {
     $dao = $this->getDao();
     return $dao->delLock($item->getId());
 }
コード例 #5
0
ファイル: Reminder.class.php プロジェクト: pombredanne/tuleap
 /**
  * Retrieve project for a given docman item
  *
  * @param Docman_Item $docmanItem The docman item we want to get its project
  *
  * @return Project
  */
 private function getItemProject(Docman_Item $docmanItem)
 {
     $pm = ProjectManager::instance();
     return $pm->getProject($docmanItem->getGroupId());
 }
コード例 #6
0
 private function createSystemEvent($type, $priority, Docman_Item $item, $additional_params = '')
 {
     if ($this->isAllowed($item->getGroupId())) {
         $params = $item->getGroupId() . SystemEvent::PARAMETER_SEPARATOR . $item->getId();
         if ($additional_params) {
             $params .= SystemEvent::PARAMETER_SEPARATOR . $additional_params;
         }
         SystemEventManager::instance()->createEvent($type, $params, $priority);
     }
 }
コード例 #7
0
 public function getLinkContent(Docman_Item $item)
 {
     return array('content' => $item->getUrl());
 }
コード例 #8
0
 /**
  * Logging a version deletion event
  *
  * @param Docman_Item    $item
  * @param User           $user
  *
  * @return void
  */
 function fireDeleteEvent($item, $user)
 {
     $value = $this->getNumber();
     if ($this->getLabel() != '') {
         $value .= ' (' . $this->getLabel() . ')';
     }
     $params = array('group_id' => $item->getGroupId(), 'item' => $item, 'old_value' => $value, 'user' => $user);
     EventManager::instance()->processEvent('plugin_docman_event_del_version', $params);
 }
コード例 #9
0
 public function add(Docman_Item $item)
 {
     $this->item_ids[] = $item->getId();
 }
コード例 #10
0
 /**
  * List versions of the item that are deleted but not already purged
  *
  * @param Docman_Item $item
  *
  * @return Array()
  */
 function listVersionsToPurgeForItem($item)
 {
     $dao = $this->_getVersionDao();
     $dar = $dao->listVersionsToPurgeByItemId($item->getId());
     if ($dar && !$dar->isError() && $dar->rowCount() > 0) {
         $list = array();
         foreach ($dar as $row) {
             $version = new Docman_Version($row);
             $list[] = $version;
         }
         return $list;
     }
     return false;
 }
コード例 #11
0
 /**
  * Returns the list of values that watermark the document
  * 
  * @param Docman_Item $item
  * 
  * @return Array of Docman_MetadataListOfValuesElement
  */
 public function getWatermarkingValues($item)
 {
     if (!isset($this->_watermarkedValues[$item->getId()])) {
         $md = $this->_getWatermarkedMetadata($item->getGroupId());
         $this->_getWatermarkingValues($item, $md);
     }
     return $this->_watermarkedValues[$item->getId()];
 }
コード例 #12
0
 /**
  * Get the JS action for the item/user couple
  * 
  * @param Docman_Item $item
  */
 function getActionForItem($item)
 {
     $js = 'docman.addActionForItem(' . $item->getId() . ', ';
     $params = array();
     $itemMenuVisitor =& new Docman_View_GetMenuItemsVisitor($this->_controller->getUser(), $item->getGroupId());
     $user_actions = $item->accept($itemMenuVisitor, $params);
     $js .= $this->phpArrayToJsArray($user_actions);
     $js .= ");\n";
     return $js;
 }
コード例 #13
0
 function toRow()
 {
     $row = parent::toRow();
     $row['item_type'] = PLUGIN_DOCMAN_ITEM_TYPE_FOLDER;
     return $row;
 }
 /**
  * @return WikiPage
  */
 protected function getWikiPage(Docman_Item $item, $project_id)
 {
     return new WikiPage($project_id, $item->getPagename());
 }
コード例 #15
0
 /**
  * Returns ugroups of an item in a human readable format
  *
  * @param Docman_Item $item
  *
  * @return array
  */
 public function exportPermissions(Docman_Item $item)
 {
     $project = ProjectManager::instance()->getProject($item->getGroupId());
     $literalizer = new UGroupLiteralizer();
     $ugroup_ids = $this->getUgroupIdsPermissions($item, $literalizer, $project);
     return $literalizer->ugroupIdsToString($ugroup_ids, $project);
 }
コード例 #16
0
 /**
  * Returns the list of users monitoring the given item with an array associated to the item the user actually monitors:
  * getListeningUsers(item(10))
  * =>
  *  array(101 => item(10) // The user is monitoring the item(10) directly
  *        102 => item(20) // The user is monitoring item(10) through item(20) "sub-hierarchy"
  *  )
  *
  * @param Docman_Item $item  Item which listenners will be retrieved
  * @param Array       $users Array where listeners are inserted.
  * @param String      $type  Type of listener, in order to retrieve listeners that monitor this item on a sub-hierarchy or not.
  *
  * @return Array
  */
 public function getListeningUsers(Docman_Item $item, $users = array(), $type = PLUGIN_DOCMAN_NOTIFICATION)
 {
     $dar = $this->dao->searchUserIdByObjectIdAndType($item->getId(), $type ? $type : PLUGIN_DOCMAN_NOTIFICATION_CASCADE);
     if ($dar) {
         foreach ($dar as $user) {
             if (!array_key_exists($user['user_id'], $users)) {
                 $users[$user['user_id']] = $item;
             }
         }
     }
     if ($id = $item->getParentId()) {
         $item = $this->_item_factory->getItemFromDb($id);
         $users = $this->getListeningUsers($item, $users, PLUGIN_DOCMAN_NOTIFICATION_CASCADE);
     }
     return $users;
 }
コード例 #17
0
 private function getIndexedData(Docman_Item $item, Docman_Version $version)
 {
     return array('id' => $item->getId(), 'group_id' => $item->getGroupId(), 'title' => $item->getTitle(), 'description' => $item->getDescription(), 'permissions' => $this->permissions_manager->exportPermissions($item), 'file' => $this->fileContentEncode($version->getPath()));
 }
コード例 #18
0
 /**
  * Mark the deleted item as purged
  *
  * @param Docman_Item $item
  *
  * @return Boolean
  */
 public function purgeDeletedItem($item)
 {
     $dao = $this->_getItemDao();
     return $dao->setPurgeDate($item->getId(), time());
 }
コード例 #19
0
 private function getDocmanSerializedParameters(Docman_Item $item, array $additional_params = array())
 {
     return implode(SystemEvent::PARAMETER_SEPARATOR, array_merge(array($item->getGroupId(), $item->getId()), $additional_params));
 }
コード例 #20
0
 private function anItem()
 {
     $item = new Docman_Item();
     $item->setId($this->uniqId());
     return $item;
 }
コード例 #21
0
 private function mappingNeedsToBoUpdated(Docman_Item $item, array $mapping_data)
 {
     return $mapping_data[$item->getGroupId()][ElasticSearch_1_2_RequestDocmanDataFactory::MAPPING_PROPERTIES_KEY] !== array();
 }
コード例 #22
0
 public function getXML(Docman_Item $item)
 {
     return $item->accept($this);
 }