function getPostList()
 {
     $oDocumentList = array();
     $args->module_srl = join(',', array($this->module_srl, $this->module_srl * -1));
     $output = executeQueryArray('textyle.getExportDocumentList', $args);
     if ($output->data) {
         foreach ($output->data as $attribute) {
             $oDocument = new documentItem();
             $oDocument->setAttribute($attribute, false);
             $oDocument->category = $this->category_list[$oDocument->get('category_srl')]->title;
             $oDocumentList[] = $oDocument;
         }
     }
     return $oDocumentList;
 }
Пример #2
0
 /**
  * Update read counts of the document
  * @param documentItem $oDocument
  * @return bool|void
  */
 function updateReadedCount(&$oDocument)
 {
     // Pass if Crawler access
     if (\Rhymix\Framework\UA::isRobot()) {
         return false;
     }
     $oDocumentModel = getModel('document');
     $config = $oDocumentModel->getDocumentConfig();
     if ($config->view_count_option == 'none') {
         return false;
     }
     $document_srl = $oDocument->document_srl;
     $member_srl = $oDocument->get('member_srl');
     $logged_info = Context::get('logged_info');
     // Call a trigger when the read count is updated (before)
     $trigger_output = ModuleHandler::triggerCall('document.updateReadedCount', 'before', $oDocument);
     if (!$trigger_output->toBool()) {
         return $trigger_output;
     }
     // Pass if read count is increaded on the session information
     if ($_SESSION['readed_document'][$document_srl] && $config->view_count_option == 'once') {
         return false;
     } else {
         if ($config->view_count_option == 'some') {
             if ($_SESSION['readed_document'][$document_srl]) {
                 return false;
             }
         }
     }
     if ($config->view_count_option == 'once') {
         // Pass if the author's IP address is as same as visitor's.
         if ($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR'] && Context::getSessionStatus()) {
             $_SESSION['readed_document'][$document_srl] = true;
             return false;
         }
         // Pass ater registering sesscion if the author is a member and has same information as the currently logged-in user.
         if ($member_srl && $logged_info->member_srl == $member_srl) {
             $_SESSION['readed_document'][$document_srl] = true;
             return false;
         }
     }
     $oDB = DB::getInstance();
     $oDB->begin();
     // Update read counts
     $args = new stdClass();
     $args->document_srl = $document_srl;
     executeQuery('document.updateReadedCount', $args);
     // Call a trigger when the read count is updated (after)
     ModuleHandler::triggerCall('document.updateReadedCount', 'after', $oDocument);
     $oDB->commit();
     //remove document item from cache
     Rhymix\Framework\Cache::delete('document_item:' . getNumberingPath($document_srl) . $document_srl);
     // Register session
     if (!$_SESSION['banned_document'][$document_srl] && Context::getSessionStatus()) {
         $_SESSION['readed_document'][$document_srl] = true;
     }
     return TRUE;
 }
Пример #3
0
 /**
  * Update read counts of the document
  * @param documentItem $oDocument
  * @return bool|void
  */
 function updateReadedCount(&$oDocument)
 {
     $document_srl = $oDocument->document_srl;
     $member_srl = $oDocument->get('member_srl');
     $logged_info = Context::get('logged_info');
     // Call a trigger when the read count is updated (before)
     $trigger_output = ModuleHandler::triggerCall('document.updateReadedCount', 'before', $oDocument);
     if (!$trigger_output->toBool()) {
         return $trigger_output;
     }
     // Pass if read count is increaded on the session information
     if ($_SESSION['readed_document'][$document_srl]) {
         return false;
     }
     // Pass if the author's IP address is as same as visitor's.
     if ($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR']) {
         $_SESSION['readed_document'][$document_srl] = true;
         return false;
     }
     // Pass ater registering sesscion if the author is a member and has same information as the currently logged-in user.
     if ($member_srl && $logged_info->member_srl == $member_srl) {
         $_SESSION['readed_document'][$document_srl] = true;
         return false;
     }
     $oDB = DB::getInstance();
     $oDB->begin();
     // Update read counts
     $args = new stdClass();
     $args->document_srl = $document_srl;
     $output = executeQuery('document.updateReadedCount', $args);
     // Call a trigger when the read count is updated (after)
     $outptrigger_outputut = ModuleHandler::triggerCall('document.updateReadedCount', 'after', $oDocument);
     if (!$trigger_output->toBool()) {
         $oDB->rollback();
         return $trigger_output;
     }
     $oDB->commit();
     $oCacheHandler = CacheHandler::getInstance('object');
     if ($oCacheHandler->isSupport()) {
         //remove document item from cache
         $cache_key = 'document_item:' . getNumberingPath($document_srl) . $document_srl;
         $oCacheHandler->delete($cache_key);
     }
     // Register session
     $_SESSION['readed_document'][$document_srl] = true;
     return TRUE;
 }
Пример #4
0
 /**
  * Update read counts of the document
  * @param documentItem $oDocument
  * @return bool|void
  */
 function updateReadedCount(&$oDocument)
 {
     $document_srl = $oDocument->document_srl;
     $member_srl = $oDocument->get('member_srl');
     $logged_info = Context::get('logged_info');
     // Call a trigger when the read count is updated (after)
     $output = ModuleHandler::triggerCall('document.updateReadedCount', 'after', $oDocument);
     if (!$output->toBool()) {
         return $output;
     }
     // Pass if read count is increaded on the session information
     if ($_SESSION['readed_document'][$document_srl]) {
         return false;
     }
     // Pass if the author's IP address is as same as visitor's.
     if ($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR']) {
         $_SESSION['readed_document'][$document_srl] = true;
         return false;
     }
     // Pass ater registering sesscion if the author is a member and has same information as the currently logged-in user.
     if ($member_srl && $logged_info->member_srl == $member_srl) {
         $_SESSION['readed_document'][$document_srl] = true;
         return false;
     }
     // Update read counts
     $args->document_srl = $document_srl;
     $output = executeQuery('document.updateReadedCount', $args);
     // Register session
     $_SESSION['readed_document'][$document_srl] = true;
     //remove from cache
     $oCacheHandler =& CacheHandler::getInstance('object');
     if ($oCacheHandler->isSupport()) {
         $cache_key = 'object:' . $document_srl;
         $oCacheHandler->delete($cache_key);
         $oCacheHandler->invalidateGroupKey('documentList');
         //remove document item from cache
         $cache_key = 'object_document_item:' . $document_srl;
         $oCacheHandler->delete($cache_key);
     }
 }
Пример #5
0
 /**
  * Import page of the document, module_srl Without throughout ..
  * @param documentItem $oDocument
  * @param object $opt
  * @return int
  */
 function getDocumentPage($oDocument, $opt)
 {
     $sort_check = $this->_setSortIndex($opt, TRUE);
     $opt->sort_index = $sort_check->sort_index;
     $opt->isExtraVars = $sort_check->isExtraVars;
     $this->_setSearchOption($opt, $args, $query_id, $use_division);
     if ($sort_check->isExtraVars) {
         return 1;
     } else {
         if ($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order') {
             if ($args->order_type === 'desc') {
                 $args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
             } else {
                 $args->{$sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
             }
         } else {
             return 1;
         }
     }
     // Guhanhu total number of the article search page
     $output = executeQuery($query_id . 'Page', $args);
     $count = $output->data->count;
     $page = (int) (($count - 1) / $opt->list_count) + 1;
     return $page;
 }