public function buildLinks($fileid) { $user = new Users(); $rowSetUsers = $this->getLinkOnAvatar($fileid); foreach ($rowSetUsers as $rowUser) { $user->set($rowUser); Sydney_Search_Files_Result::init($user->getModule(), 'Avatar', $user->get()->id); Sydney_Search_Files_Result::add('label', $user->__toString()); Sydney_Search_Files_Result::add('link', '/adminpeople/index/editindex/id/' . $user->get()->id); } }
public function buildLinks($fileid) { // links in text bloc $rowSetContent = $this->getLinkOnTextBlock($fileid); foreach ($rowSetContent as $rowContent) { if ($myparent = $this->getParent($rowContent->id)) { Sydney_Search_Files_Result::init($myparent->getModule(), 'Text block', $myparent->get()->id); Sydney_Search_Files_Result::add('label', $myparent->__toString()); Sydney_Search_Files_Result::add('link', '/adminpages/pages/edit/id/' . $myparent->get()->id . ($myparent->getModule() == 'adminnews' ? '/emodule/news' : '')); } } // links in content file $rowSetContent = $this->getLinkOnContentFile($fileid); foreach ($rowSetContent as $rowContent) { if ($myparent = $this->getParent($rowContent->id)) { Sydney_Search_Files_Result::init($myparent->getModule(), 'File', $myparent->get()->id); Sydney_Search_Files_Result::add('label', $myparent->__toString()); Sydney_Search_Files_Result::add('link', '/adminpages/pages/edit/id/' . $myparent->get()->id . ($myparent->getModule() == 'adminnews' ? '/emodule/news' : '')); } } // links on categories $listLinkedFiles = $this->getLinkOnFolder($fileid); if (count($listLinkedFiles) > 0) { // search if the folder has linked to content foreach ($listLinkedFiles as $linkId) { $rowSetContent = $this->getLinkOnContentFile($linkId); foreach ($rowSetContent as $rowContent) { if ($myparent = $this->getParent($rowContent->id)) { Sydney_Search_Files_Result::init($myparent->getModule(), 'File by category', $myparent->get()->id); Sydney_Search_Files_Result::add('label', $myparent->__toString()); Sydney_Search_Files_Result::add('link', '/adminpages/pages/edit/id/' . $myparent->get()->id . ($myparent->getModule() == 'adminnews' ? '/emodule/news' : '')); } } } } }
/** * Buils a list of content/resource where a link to the file are found * @param $fileid * @return array */ public function getLinks($fileid) { Sydney_Search_Files_Pages_Links::getInstance()->buildLinks($fileid); Sydney_Search_Files_Users_Links::getInstance()->buildLinks($fileid); return Sydney_Search_Files_Result::get(); }
public static function init($module, $contentType, $key) { self::$currentModule = $module; self::$currentContentType = $contentType; self::$currentKey = $key; }