コード例 #1
0
ファイル: category_dao.php プロジェクト: SongPhi/spdownload
 public static function getInstance()
 {
     if (self::$classInstance === null) {
         self::$classInstance = new self();
     }
     return self::$classInstance;
 }
コード例 #2
0
ファイル: categories.php プロジェクト: SongPhi/spdownload
 public function cateList()
 {
     $this->setPageTitle(OW::getLanguage()->text('spdownload', 'index_category_title'));
     $this->setPageHeading(OW::getLanguage()->text('spdownload', 'index_category_heading'));
     $categories = SPDOWNLOAD_BOL_CategoryService::getInstance()->getCategoryList();
     foreach ($categories as $key => $value) {
         if ($value->parentId == 0) {
             $value->parentId = null;
         } else {
             $value->parentId = SPDOWNLOAD_BOL_CategoryDao::getInstance()->findById($value->parentId)->name;
         }
         $value->urlDelete = OW::getRouter()->urlForRoute('spdownload.category_delete', array('categoryId' => $value->id));
         $value->countParent = SPDOWNLOAD_BOL_CategoryService::getInstance()->getCountCategoryParent($value->id);
     }
     $this->assign('categories', $categories);
 }
コード例 #3
0
ファイル: downloads.php プロジェクト: SongPhi/spdownload
 public function detail($params)
 {
     $document = OW::getDocument();
     $plugin = OW::getPluginManager()->getPlugin('spdownload');
     $document->addStyleSheet($plugin->getStaticCssUrl() . 'file_detail.css');
     $check = $params['fileId'];
     if (!stripos($params['fileId'], "-")) {
         throw new Redirect404Exception();
     }
     $params['fileId'] = substr($params['fileId'], 0, stripos($params['fileId'], "-"));
     $file = SPDOWNLOAD_BOL_FileService::getInstance()->getFileId($params['fileId']);
     if ($file->id . '-' . $file->slug != $check) {
         throw new Redirect404Exception();
     }
     $cmpThumbnails = new SPDOWNLOAD_CMP_Thumbnail($params['fileId']);
     $this->addComponent('cmpThumbnails', $cmpThumbnails);
     $params['authorId'] = $file->authorId;
     $params['quantitySoft'] = 2;
     $cmpRelatedItemUser = new SPDOWNLOAD_CMP_RelatedItemUser($params);
     $this->addComponent('cmpRelatedItemUser', $cmpRelatedItemUser);
     $filevernew = SPDOWNLOAD_BOL_VersionService::getInstance()->getFileVerNew($params['fileId']);
     $limit = 3;
     $fileverold = SPDOWNLOAD_BOL_VersionService::getInstance()->getFileOldVersion($params['fileId'], $filevernew[0]->id, $limit);
     $filevernew[0]->size = $this->splitFilesize($filevernew[0]->size);
     foreach ($fileverold as $key => $value) {
         $value->size = $this->splitFilesize($value->size);
     }
     // rate
     $rateInfo = new BASE_CMP_Rate('spdownload', 'spdownload-software', $file->getId(), $file->authorId);
     $this->addComponent('rate', $rateInfo);
     // comments
     $allow_comments = true;
     if ($file->authorId != OW::getUser()->getId() && !OW::getUser()->isAuthorized('spdownload')) {
         $eventParams = array('action' => 'spdownload_comment_spdownload-posts', 'ownerId' => $file->authorId, 'viewerId' => OW::getUser()->getId());
         try {
             OW::getEventManager()->getInstance()->call('privacy_check_permission', $eventParams);
         } catch (RedirectException $ex) {
             $allow_comments = false;
         }
     }
     $cmpParams = new BASE_CommentsParams('spdownload', 'spdownload-post');
     $cmpParams->setEntityId($file->getId())->setOwnerId($file->authorId)->setDisplayType(BASE_CommentsParams::DISPLAY_TYPE_BOTTOM_FORM_WITH_FULL_LIST)->setAddComment($allow_comments);
     $this->addComponent('comments', new BASE_CMP_Comments($cmpParams));
     $arraylabel = array("filename" => OW::getLanguage()->text('spdownload', 'label_file_name'), "filesize" => OW::getLanguage()->text('spdownload', 'label_file_size'), "filetype" => OW::getLanguage()->text('spdownload', 'label_file_type'), "filedown" => OW::getLanguage()->text('spdownload', 'label_file_download'));
     $url = OW::getPluginManager()->getPlugin('spdownload')->getUserFilesUrl();
     $nameImage = 'icon_large_' . $file->id . '.png';
     $file->icon = $url . $nameImage;
     $CategoryIdList = SPDOWNLOAD_BOL_FileCategoryService::getInstance()->getCategoryId($params['fileId']);
     $arrayCategory = array();
     foreach ($CategoryIdList as $key => $value) {
         $categories = SPDOWNLOAD_BOL_CategoryDao::getInstance()->findById($value->categoryId);
         $arrayCategory[$value->categoryId] = $categories->name;
     }
     $this->assign('arrayCategory', $arrayCategory);
     $this->assign('file', $file);
     $this->assign('var', $file->id);
     $this->assign('filevernew', $filevernew[0]);
     $this->assign('fileverold', $fileverold);
     $this->assign('arraylabel', $arraylabel);
 }
コード例 #4
0
 public function getCountCategoryParent($categoryId)
 {
     return SPDOWNLOAD_BOL_CategoryDao::getInstance()->countCategoryParent($categoryId);
 }