コード例 #1
0
ファイル: content.class.php プロジェクト: relip/xe-core
 function _getTrackbackItems($args)
 {
     // Get categories
     $output = executeQueryArray('widgets.content.getCategories', $obj);
     if ($output->toBool() && $output->data) {
         foreach ($output->data as $key => $val) {
             $category_lists[$val->module_srl][$val->category_srl] = $val;
         }
     }
     $obj->module_srl = $args->module_srl;
     $obj->sort_index = $args->order_target;
     $obj->list_count = $args->list_count * $args->page_count;
     // Get model object from the trackback module and execute getTrackbackList() method
     $oTrackbackModel =& getModel('trackback');
     $output = $oTrackbackModel->getNewestTrackbackList($obj);
     // If an error occurs, just ignore it.
     if (!$output->toBool() || !$output->data) {
         return;
     }
     // If the result exists, make each document as an object
     $content_items = array();
     foreach ($output->data as $key => $item) {
         $domain = $args->module_srls_info[$item->module_srl]->domain;
         $category = $category_lists[$item->module_srl]->text;
         $url = getSiteUrl($domain, '', 'document_srl', $item->document_srl);
         $browser_title = $args->module_srls_info[$item->module_srl]->browser_title;
         $content_item = new contentItem($browser_title);
         $content_item->adds($item);
         $content_item->setTitle($item->title);
         $content_item->setCategory($category);
         $content_item->setNickName($item->blog_name);
         $content_item->setContent($item->excerpt);
         ///<<
         $content_item->setDomain($domain);
         ///<<
         $content_item->setLink($url);
         $content_item->add('mid', $args->mid_lists[$item->module_srl]);
         $content_item->setRegdate($item->regdate);
         $content_items[] = $content_item;
     }
     return $content_items;
 }
コード例 #2
0
 function _getTrackbackItems($args)
 {
     // 분류 구함
     $output = executeQueryArray('widgets.content.getCategories', $obj);
     if ($output->toBool() && $output->data) {
         foreach ($output->data as $key => $val) {
             $category_lists[$val->module_srl][$val->category_srl] = $val;
         }
     }
     $obj->module_srl = $args->module_srl;
     $obj->sort_index = $args->order_target;
     $obj->list_count = $args->list_count * $args->page_count;
     // trackback 모듈의 model 객체를 받아서 getTrackbackList() method를 실행
     $oTrackbackModel =& getModel('trackback');
     $output = $oTrackbackModel->getNewestTrackbackList($obj);
     // 오류가 생기면 그냥 무시
     if (!$output->toBool() || !$output->data) {
         return;
     }
     // 결과가 있으면 각 문서 객체화를 시킴
     $content_items = array();
     foreach ($output->data as $key => $item) {
         $domain = $args->module_srls_info[$item->module_srl]->domain;
         $category = $category_lists[$item->module_srl]->text;
         $url = getSiteUrl($domain, '', 'document_srl', $item->document_srl);
         $browser_title = $args->module_srls_info[$item->module_srl]->browser_title;
         $content_item = new contentItem($browser_title);
         $content_item->adds($item);
         $content_item->setTitle($item->title);
         $content_item->setCategory($category);
         $content_item->setNickName($item->blog_name);
         $content_item->setContent($item->excerpt);
         ///<<
         $content_item->setDomain($domain);
         ///<<
         $content_item->setLink($url);
         $content_item->add('mid', $args->mid_lists[$item->module_srl]);
         $content_item->setRegdate($item->regdate);
         $content_items[] = $content_item;
     }
     return $content_items;
 }
コード例 #3
0
 function _getDocumentItems($args)
 {
     // Get model object from the document module
     $oDocumentModel =& getModel('document');
     // Get categories
     $obj = new stdClass();
     $obj->module_srl = $args->module_srl;
     $output = executeQueryArray('widgets.flatContent.getCategories', $obj);
     if ($output->toBool() && $output->data) {
         foreach ($output->data as $key => $val) {
             $category_lists[$val->module_srl][$val->category_srl] = $val;
         }
     }
     // Get a list of documents
     $obj->module_srl = $args->module_srl;
     $obj->category_srl = $args->category_srl;
     $obj->sort_index = $args->order_target;
     if ($args->order_target == 'list_order' || $args->order_target == 'update_order') {
         $obj->order_type = $args->order_type == "desc" ? "asc" : "desc";
     } else {
         $obj->order_type = $args->order_type == "desc" ? "desc" : "asc";
     }
     $obj->list_count = $args->list_count * $args->page_count;
     $obj->statusList = array('PUBLIC');
     if ($args->regdate) {
         $obj->regdate = date("Ymd", strtotime("-{$args->regdate} day"));
     }
     $output = executeQueryArray('widgets.flatContent.getNewestDocuments', $obj);
     if (!$output->toBool() || !$output->data) {
         return;
     }
     // If the result exists, make each document as an object
     $content_items = array();
     $first_thumbnail_idx = -1;
     if (count($output->data)) {
         foreach ($output->data as $key => $attribute) {
             $oDocument = new documentItem();
             $oDocument->setAttribute($attribute, false);
             $GLOBALS['XE_DOCUMENT_LIST'][$oDocument->document_srl] = $oDocument;
             $document_srls[] = $oDocument->document_srl;
         }
         $oDocumentModel->setToAllDocumentExtraVars();
         for ($i = 0, $c = count($document_srls); $i < $c; $i++) {
             $oDocument = $GLOBALS['XE_DOCUMENT_LIST'][$document_srls[$i]];
             $document_srl = $oDocument->document_srl;
             $module_srl = $oDocument->get('module_srl');
             $category_srl = $oDocument->get('category_srl');
             $thumbnail = $oDocument->getThumbnail($args->thumbnail_width, $args->thumbnail_height, $args->thumbnail_type);
             $content_item = new contentItem($args->module_srls_info[$module_srl]->browser_title);
             $content_item->adds($oDocument->getObjectVars());
             $content_item->add('original_content', $oDocument->get('content'));
             $content_item->setTitle($oDocument->getTitleText());
             $content_item->setCategory($category_lists[$module_srl][$category_srl]->title);
             $content_item->setDomain($args->module_srls_info[$module_srl]->domain);
             $content_item->setContent($oDocument->getSummary($args->content_cut_size));
             $content_item->setLink(getSiteUrl($domain, '', 'document_srl', $document_srl));
             $content_item->setThumbnail($thumbnail);
             $content_item->setExtraImages($oDocument->printExtraImages($args->duration_new * 60 * 60));
             $content_item->add('mid', $args->mid_lists[$module_srl]);
             if ($first_thumbnail_idx == -1 && $thumbnail) {
                 $first_thumbnail_idx = $i;
             }
             $content_items[] = $content_item;
         }
         $content_items[0]->setFirstThumbnailIdx($first_thumbnail_idx);
     }
     $oSecurity = new Security($content_items);
     $oSecurity->encodeHTML('..variables.content', '..variables.user_name', '..variables.nick_name');
     return $content_items;
 }