merge from 1.5.3 (~r10943)

git-svn-id: http://xe-core.googlecode.com/svn/trunk@10951 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
flyskyko 2012-07-27 02:47:10 +00:00
parent 7aa4798373
commit 54e3a72065
334 changed files with 13011 additions and 5561 deletions

View file

@ -1,24 +1,34 @@
<?php
/**
* @class documentModel
* @author NHN (developers@xpressengine.com)
* @brief model class of the module document
**/
/**
* documentModel class
* model class of the module document
*
* @author NHN (developers@xpressengine.com)
* @package /modules/document
* @version 0.1
*/
class documentModel extends document {
/**
* @brief Initialization
**/
/**
* Initialization
* @return void
*/
function init() {
}
/**
* @brief document checked the permissions on the session values
**/
/**
* document checked the permissions on the session values
* @param int $document_srl
* @return void
*/
function isGranted($document_srl) {
return $_SESSION['own_document'][$document_srl];
}
/**
* Return document extra information from database
* @param array $documentSrls
* @return object
*/
function getDocumentExtraVarsFromDB($documentSrls)
{
if(!is_array($documentSrls) || count($documentSrls) == 0)
@ -31,9 +41,10 @@
return $output;
}
/**
* @brief extra variables for each article will not be processed bulk select and apply the macro city
**/
/**
* Extra variables for each article will not be processed bulk select and apply the macro city
* @return void
*/
function setToAllDocumentExtraVars() {
static $checked_documents = array();
// XE XE_DOCUMENT_LIST all documents that the object referred to the global variable settings
@ -98,25 +109,36 @@
}
}
/**
* @brief Import Document
**/
/**
* Import Document
* @param int $document_srl
* @param bool $is_admin
* @param bool $load_extra_vars
* @param array $columnList
* @return documentItem
*/
function getDocument($document_srl=0, $is_admin = false, $load_extra_vars=true, $columnList = array()) {
if(!$document_srl) return new documentItem();
if(!isset($GLOBALS['XE_DOCUMENT_LIST'][$document_srl])) {
if(!isset($GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) || $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->columnListKey != serialize($columnList)) {
$oDocument = new documentItem($document_srl, $load_extra_vars, $columnList);
$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
if($load_extra_vars) $this->setToAllDocumentExtraVars();
$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->columnListKey = serialize($columnList);
}
if($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant();
return $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
}
/**
* @brief Bringing multiple documents (or paging)
**/
/**
* Bringing multiple documents (or paging)
* @param array|string $document_srls
* @param bool $is_admin
* @param bool $load_extra_vars
* @param array $columnList
* @return array value type is documentItem
*/
function getDocuments($document_srls, $is_admin = false, $load_extra_vars=true, $columnList = array()) {
if(is_array($document_srls)) {
$list_count = count($document_srls);
@ -161,9 +183,14 @@
return $output;
}
/**
* @brief module_srl value, bringing the list of documents
**/
/**
* Module_srl value, bringing the list of documents
* @param object $obj
* @param bool $except_notice
* @param bool $load_extra_vars
* @param array $columnList
* @return Object
*/
function getDocumentList($obj, $except_notice = false, $load_extra_vars=true, $columnList = array()) {
$sort_check = $this->_setSortIndex($obj, $load_extra_vars);
$obj->sort_index = $sort_check->sort_index;
@ -241,12 +268,12 @@
{
/**
* list_order asc sort of division that can be used only when
**/
*/
if($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false;
/**
* If it is true, use_division changed to use the document division
**/
*/
if($use_division) {
// Division begins
$division = (int)Context::get('division');
@ -388,9 +415,12 @@
return $output;
}
/**
* @brief module_srl value, bringing the document's gongjisa Port
**/
/**
* Module_srl value, bringing the document's gongjisa Port
* @param object $obj
* @param array $columnList
* @return object|void
*/
function getNoticeList($obj, $columnList = array()) {
$args->module_srl = $obj->module_srl;
$args->category_srl= $obj->category_srl;
@ -418,10 +448,12 @@
return $result;
}
/**
* @brief function to retrieve the key values of the extended variable document
* $Form_include: writing articles whether to add the necessary extensions of the variable input form
**/
/**
* Function to retrieve the key values of the extended variable document
* $Form_include: writing articles whether to add the necessary extensions of the variable input form
* @param int $module_srl
* @return array
*/
function getExtraKeys($module_srl) {
if(is_null($GLOBALS['XE_EXTRA_KEYS'][$module_srl])) {
$oExtraVar = &ExtraVar::getInstance($module_srl);
@ -483,9 +515,12 @@
return $GLOBALS['XE_EXTRA_KEYS'][$module_srl];
}
/**
* @brief A particular document to get the value of the extra variable function
**/
/**
* A particular document to get the value of the extra variable function
* @param int $module_srl
* @param int $document_srl
* @return array
*/
function getExtraVars($module_srl, $document_srl) {
if(!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl])) {
// Extended to extract the values of variables set
@ -497,11 +532,11 @@
return $GLOBALS['XE_EXTRA_VARS'][$document_srl];
}
/**
* @brief Show pop-up menu of the selected posts
*
* Printing, scrap, recommendations and negative, reported the Add Features
**/
/**
* Show pop-up menu of the selected posts
* Printing, scrap, recommendations and negative, reported the Add Features
* @return void
*/
function getDocumentMenu() {
// Post number and the current login information requested Wanted
$document_srl = Context::get('target_srl');
@ -575,9 +610,12 @@
$this->add('menus', $menus);
}
/**
* @brief module_srl the total number of documents that are bringing
**/
/**
* The total number of documents that are bringing
* @param int $module_srl
* @param object $search_obj
* @return int
*/
function getDocumentCount($module_srl, $search_obj = NULL) {
// Additional search options
$args->module_srl = $module_srl;
@ -595,9 +633,11 @@
return (int)$total_count;
}
/**
* @brief module_srl the total number of documents that are bringing
**/
/**
* the total number of documents that are bringing
* @param object $search_obj
* @return array
*/
function getDocumentCountByGroupStatus($search_obj = NULL) {
// Additional search options
$args->module_srl = $search_obj->module_srl;
@ -614,9 +654,12 @@
return $output->data;
}
/**
* @brief Import page of the document, module_srl Without throughout ..
**/
/**
* Import page of the document, module_srl Without throughout ..
* @param documentItem $oDocument
* @param object $opt
* @return int
*/
function getDocumentPage($oDocument, $opt) {
// Sort type changes depending on the query args
switch($opt->sort_index) {
@ -679,9 +722,12 @@
return $page;
}
/**
* @brief Imported Category of information
**/
/**
* Imported Category of information
* @param int $category_srl
* @param array $columnList
* @return object
*/
function getCategory($category_srl, $columnList = array()) {
$args->category_srl = $category_srl;
$output = executeQuery('document.getCategory', $args, $columnList);
@ -700,9 +746,11 @@
return $node;
}
/**
* @brief Check whether the child has a specific category
**/
/**
* Check whether the child has a specific category
* @param int $category_srl
* @return bool
*/
function getCategoryChlidCount($category_srl) {
$args->category_srl = $category_srl;
$output = executeQuery('document.getChildCategoryCount',$args);
@ -710,10 +758,13 @@
return false;
}
/**
* @brief Bringing the Categories list the specific module
* Speed and variety of categories, considering the situation created by the php script to include a list of the must, in principle, to use
**/
/**
* Bringing the Categories list the specific module
* Speed and variety of categories, considering the situation created by the php script to include a list of the must, in principle, to use
* @param int $module_srl
* @param array $columnList
* @return array
*/
function getCategoryList($module_srl, $columnList = array()) {
// Category of the target module file swollen
$filename = sprintf("./files/cache/document_category/%s.php", $module_srl);
@ -730,9 +781,13 @@
return $document_category;
}
/**
* @brief Category within a primary method to change the array type
**/
/**
* Category within a primary method to change the array type
* @param array $document_category
* @param array $list
* @param int $depth
* @return void
*/
function _arrangeCategory(&$document_category, $list, $depth) {
if(!count($list)) return;
$idx = 0;
@ -785,9 +840,12 @@
$document_category[$list_order[count($list_order)-1]]->last = true;
}
/**
* @brief Wanted number of documents belonging to category
**/
/**
* Wanted number of documents belonging to category
* @param int $module_srl
* @param int $category_srl
* @return int
*/
function getCategoryDocumentCount($module_srl, $category_srl) {
$args->module_srl = $module_srl;
$args->category_srl = $category_srl;
@ -795,9 +853,11 @@
return (int)$output->data->count;
}
/**
* @brief Xml cache file of the document category return information
**/
/**
* Xml cache file of the document category return information
* @param int $module_srl
* @return string
*/
function getCategoryXmlFile($module_srl) {
$xml_file = sprintf('files/cache/document_category/%s.xml.php',$module_srl);
if(!file_exists($xml_file)) {
@ -807,9 +867,11 @@
return $xml_file;
}
/**
* @brief Php cache files in the document category return information
**/
/**
* Php cache files in the document category return information
* @param int $module_srl
* @return string
*/
function getCategoryPhpFile($module_srl) {
$php_file = sprintf('files/cache/document_category/%s.php',$module_srl);
if(!file_exists($php_file)) {
@ -819,9 +881,11 @@
return $php_file;
}
/**
* @brief Imported post monthly archive status
**/
/**
* Imported post monthly archive status
* @param object $obj
* @return object
*/
function getMonthlyArchivedList($obj) {
if($obj->mid) {
$oModuleModel = &getModel('module');
@ -840,9 +904,11 @@
return $output;
}
/**
* @brief Bringing a month on the status of the daily posts
**/
/**
* Bringing a month on the status of the daily posts
* @param object $obj
* @return object
*/
function getDailyArchivedList($obj) {
if($obj->mid) {
$oModuleModel = &getModel('module');
@ -862,9 +928,10 @@
return $output;
}
/**
* @brief Get a list for a particular module
**/
/**
* Get a list for a particular module
* @return void|Object
*/
function getDocumentCategories() {
if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
$module_srl = Context::get('module_srl');
@ -880,9 +947,10 @@
$this->add('categories', $output);
}
/**
* @brief Wanted to set document information
**/
/**
* Wanted to set document information
* @return object
*/
function getDocumentConfig() {
if(!$GLOBALS['__document_config__']) {
$oModuleModel = &getModel('module');
@ -893,10 +961,12 @@
return $GLOBALS['__document_config__'];
}
/**
* @brief Common:: Module extensions of variable management
* Expansion parameter management module in the document module instance, when using all the modules available
**/
/**
* Common:: Module extensions of variable management
* Expansion parameter management module in the document module instance, when using all the modules available
* @param int $module_srl
* @return string
*/
function getExtraVarsHTML($module_srl) {
// Bringing existing extra_keys
$extra_keys = $this->getExtraKeys($module_srl);
@ -909,9 +979,11 @@
return $oTemplate->compile($this->module_path.'tpl', 'extra_keys');
}
/**
* @brief Common:: Category parameter management module
**/
/**
* Common:: Category parameter management module
* @param int $module_srl
* @return string
*/
function getCategoryHTML($module_srl) {
$category_xml_file = $this->getCategoryXmlFile($module_srl);
@ -923,10 +995,11 @@
return $oTemplate->compile($this->module_path.'tpl', 'category_list');
}
/**
* @brief Certain categories of information, return the template guhanhu
* Manager on the page to add information about a particular menu from the server after compiling tpl compiled a direct return html
**/
/**
* Certain categories of information, return the template guhanhu
* Manager on the page to add information about a particular menu from the server after compiling tpl compiled a direct return html
* @return void|Object
*/
function getDocumentCategoryTplInfo() {
$oModuleModel = &getModel('module');
$oMemberModel = &getModel('member');
@ -973,7 +1046,12 @@
$this->add('tpl', $tpl);
}
/**
* Return docuent data by alias
* @param string $mid
* @param string $alias
* @return int|void
*/
function getDocumentSrlByAlias($mid, $alias)
{
if(!$mid || !$alias) return null;
@ -986,6 +1064,12 @@
else return $output->data->document_srl;
}
/**
* Return docuent number by document title
* @param int $module_srl
* @param string $title
* @return int|void
*/
function getDocumentSrlByTitle($module_srl, $title)
{
if(!$module_srl || !$title) return null;
@ -993,9 +1077,17 @@
$args->title = $title;
$output = executeQuery('document.getDocumentSrlByTitle', $args);
if(!$output->data) return null;
else return $output->data->document_srl;
else {
if(is_array($output->data)) return $output->data[0]->document_srl;
return $output->data->document_srl;
}
}
/**
* Return docuent's alias
* @param int $document_srl
* @return string|void
*/
function getAlias($document_srl){
if(!$document_srl) return null;
$args->document_srl = $document_srl;
@ -1005,6 +1097,13 @@
else return $output->data[0]->alias_title;
}
/**
* Return document's history list
* @param int $document_srl
* @param int $list_count
* @param int $page
* @return object
*/
function getHistories($document_srl, $list_count, $page)
{
$args->list_count = $list_count;
@ -1014,6 +1113,11 @@
return $output;
}
/**
* Return document's history
* @param int $history_srl
* @return object
*/
function getHistory($history_srl)
{
$args->history_srl = $history_srl;
@ -1021,9 +1125,11 @@
return $output->data;
}
/**
* @brief module_srl value, bringing the list of documents
**/
/**
* Module_srl value, bringing the list of documents
* @param object $obj
* @return object
*/
function getTrashList($obj) {
// Variable check
$args->category_srl = $obj->category_srl?$obj->category_srl:null;
@ -1096,9 +1202,10 @@
return $output;
}
/**
* @brief vote up, vote down member list in Document View page
**/
/**
* vote up, vote down member list in Document View page
* @return void|Object
*/
function getDocumentVotedMemberList()
{
$document_srl = Context::get('document_srl');
@ -1139,6 +1246,10 @@
$this->add('voted_member_list',$output->data);
}
/**
* Return status name list
* @return array
*/
function getStatusNameList()
{
global $lang;
@ -1147,6 +1258,12 @@
else return $lang->status_name_list;
}
/**
* Setting sort index
* @param object $obj
* @param bool $load_extra_vars
* @return object
*/
function _setSortIndex($obj, $load_extra_vars)
{
$sortIndex = $obj->sort_index;
@ -1182,10 +1299,15 @@
}
/**
* @brief 게시물 목록의 검색 옵션을 Setting함(2011.03.08 - cherryfilter)
* 게시물 목록의 검색 옵션을 Setting함(2011.03.08 - cherryfilter)
* page변수가 없는 상태에서 page 값을 알아오는 method(getDocumentPage) 검색하지 않은 값을 return해서 검색한 값을 가져오도록 검색옵션이 추가 .
* 검색옵션의 중복으로 인해 private method로 별도 분리
**/
* @param object $searchOpt
* @param object $args
* @param string $query_id
* @param bool $use_division
* @return void
*/
function _setSearchOption($searchOpt, &$args, &$query_id, &$use_division)
{
$search_target = $searchOpt->search_target;