From 1245bcc6486246a4c22fb7a4af941fd59a0f861c Mon Sep 17 00:00:00 2001 From: chschy Date: Tue, 5 Jun 2012 05:49:22 +0000 Subject: [PATCH] add description of layout module files git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10766 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/layout/layout.admin.controller.php | 124 ++++++++++------ modules/layout/layout.admin.view.php | 55 ++++--- modules/layout/layout.class.php | 14 +- modules/layout/layout.model.php | 164 ++++++++++++++------- modules/layout/layout.view.php | 11 +- 5 files changed, 248 insertions(+), 120 deletions(-) diff --git a/modules/layout/layout.admin.controller.php b/modules/layout/layout.admin.controller.php index 3e1f0d6b6..1b7181e0a 100644 --- a/modules/layout/layout.admin.controller.php +++ b/modules/layout/layout.admin.controller.php @@ -2,21 +2,23 @@ /** * @class layoutAdminController * @author NHN (developers@xpressengine.com) - * @brief admin controller class of the layout module + * admin controller class of the layout module **/ class layoutAdminController extends layout { /** - * @brief Initialization + * Initialization + * @return void **/ function init() { } - // deprecated /** - * @brief Create a new layout + * Create a new layout * Insert a title into "layouts" table in order to create a layout + * @deprecated + * @return void|Object (void : success, Object : fail) **/ function procLayoutAdminInsert() { if(Context::get('layout') == 'faceoff') return $this->stop('not supported'); @@ -45,13 +47,22 @@ $this->setRedirectUrl(Context::get('success_return_url')); } - // Insert layout information into the DB + /** + * Insert layout information into the DB + * @param object $args layout information + * @return Object + **/ function insertLayout($args) { $output = executeQuery("layout.insertLayout", $args); return $output; } - // Initiate if it is faceoff layout + /** + * Initiate if it is faceoff layout + * @param int $layout_srl + * @param string $layout_name + * @return void + **/ function initLayout($layout_srl, $layout_name){ $oLayoutModel = &getModel('layout'); // Import a sample layout if it is faceoff @@ -64,8 +75,9 @@ } /** - * @brief Update layout information + * Update layout information * Apply a title of the new layout and extra vars + * @return Object **/ function procLayoutAdminUpdate() { // Consider the rest of items as extra vars, except module, act, layout_srl, layout, and title .. Some gurida .. @@ -180,6 +192,11 @@ return new Object(); } + /** + * Update layout information into the DB + * @param object $args + * @return Object + **/ function updateLayout($args) { $output = executeQuery('layout.updateLayout', $args); if($output->toBool()) { @@ -198,8 +215,9 @@ } /** - * @brief Delete Layout + * Delete Layout * Delete xml cache file too when deleting a layout + * @return Object **/ function procLayoutAdminDelete() { $layout_srl = Context::get('layout_srl'); @@ -207,6 +225,11 @@ return $this->deleteLayout($layout_srl); } + /** + * Delete layout xml cache file + * @param int $layout_srl + * @return Object + **/ function deleteLayout($layout_srl) { $oLayoutModel = &getModel('layout'); @@ -231,7 +254,8 @@ } /** - * @brief Adding Layout Code + * Adding Layout Code + * @return void|Object (void : success, Object : fail) **/ function procLayoutAdminCodeUpdate() { $mode = Context::get('mode'); @@ -264,7 +288,8 @@ } /** - * @brief Reset layout code + * Reset layout code + * @return void|Object (void : success, Object : fail) **/ function procLayoutAdminCodeReset() { $layout_srl = Context::get('layout_srl'); @@ -291,8 +316,8 @@ /** - * @brief Layout setting page -> Upload an image - * + * Layout setting page -> Upload an image + * @return void **/ function procLayoutAdminUserImageUpload(){ if(!Context::isUploaded()) exit(); @@ -309,8 +334,10 @@ } /** - * @brief Layout setting page -> Upload an image - * + * insert image into user layout + * @param int $layout_srl + * @param object $source file data + * @return boolean (true : success, false : fail) **/ function insertUserLayoutImage($layout_srl,$source){ $oLayoutModel = &getModel('layout'); @@ -328,20 +355,9 @@ return true; } - /** - * @brief Layout setting page -> Delete an image - * - **/ - function removeUserLayoutImage($layout_srl,$filename){ - $oLayoutModel = &getModel('layout'); - $path = $oLayoutModel->getUserLayoutImagePath($layout_srl); - @unlink($path . $filename); - } - - /** - * @brief Layout setting page -> Delete an image - * + * Layout setting page -> Delete an image + * @return void **/ function procLayoutAdminUserImageDelete(){ $filename = Context::get('filename'); @@ -351,10 +367,24 @@ $this->setRedirectUrl(Context::get('error_return_url')); } + /** + * delete image into user layout + * @param int $layout_srl + * @param string $filename + * @return void + **/ + function removeUserLayoutImage($layout_srl,$filename){ + $oLayoutModel = &getModel('layout'); + $path = $oLayoutModel->getUserLayoutImagePath($layout_srl); + @unlink($path . $filename); + } + // deprecated /** - * @brief Save layout configuration + * Save layout configuration * save in "ini" format for faceoff + * @deprecated + * @return void|Object (void : success, Object : fail) **/ function procLayoutAdminUserValueInsert(){ $oModuleModel = &getModel('module'); @@ -404,8 +434,10 @@ } /** - * @brief Layout setting, save "ini" - * + * Layout setting, save "ini" + * @param int $layout_srl + * @param object $arr layout ini + * @return void **/ function insertUserLayoutValue($layout_srl,$arr){ $oLayoutModel = &getModel('layout'); @@ -413,13 +445,12 @@ FileHandler::writeIniFile($file, $arr); } - function writeUserLayoutCss(){ - - } - /** - * @brief Add the widget code for faceoff into user layout file - * + * Add the widget code for faceoff into user layout file + * @param int $layout_srl + * @param object $arg + * @param string $content + * @return string **/ function addExtension($layout_srl,$arg,$content){ $oLayoutModel = &getModel('layout'); @@ -443,8 +474,9 @@ /** - * @brief Delete temp files for faceoff - * + * Delete temp files for faceoff + * @param int $layout_srl + * @return void **/ function deleteUserLayoutTempFile($layout_srl){ $oLayoutModel = &getModel('layout'); @@ -455,8 +487,8 @@ } /** - * @brief faceoff export - * + * export user layout + * @return void **/ function procLayoutAdminUserLayoutExport(){ $layout_srl = Context::get('layout_srl'); @@ -548,10 +580,10 @@ exit(); } - // deprecated /** - * @brief faceoff import - * + * faceoff import + * @deprecated + * @return void **/ function procLayoutAdminUserLayoutImport(){ return $this->stop('not supported'); @@ -574,6 +606,12 @@ $this->setRedirectUrl(Context::get('error_return_url')); } + /** + * import layout + * @param int $layout_srl + * @param string $source_file path of imported file + * @return void + **/ function importLayout($layout_srl, $source_file) { $oLayoutModel = &getModel('layout'); $user_layout_path = FileHandler::getRealPath($oLayoutModel->getUserLayoutPath($layout_srl)); diff --git a/modules/layout/layout.admin.view.php b/modules/layout/layout.admin.view.php index 1cfc39437..1f9b67b3b 100644 --- a/modules/layout/layout.admin.view.php +++ b/modules/layout/layout.admin.view.php @@ -2,20 +2,22 @@ /** * @class layoutAdminView * @author NHN (developers@xpressengine.com) - * @brief admin view class of the layout module + * admin view class of the layout module **/ class layoutAdminView extends layout { /** - * @brief Initialization + * Initialization + * @return void **/ function init() { $this->setTemplatePath($this->module_path.'tpl'); } /** - * @brief Display a installed layout list + * Display a installed layout list + * @return void **/ function dispLayoutAdminInstalledList() { // Set a layout list @@ -59,7 +61,8 @@ } /** - * @brief Display a installed mobile layout list + * Display a installed mobile layout list + * @return void */ function dispLayoutAdminInstalledMobileList() { // Set a layout list @@ -84,7 +87,8 @@ } /** - * @brief Display list of pc layout instance + * Display list of pc layout instance + * @return void|Object (void : success, Object : fail) */ function dispLayoutAdminInstanceList() { @@ -111,8 +115,9 @@ } /** - * @brief Layout setting page + * Layout setting page * Once select a layout with empty value in the DB, then adjust values + * @return void|Object (void : success, Object : fail) **/ function dispLayoutAdminInsert() { $oModel = &getModel('layout'); @@ -154,7 +159,8 @@ } /** - * @brief Insert Layout details + * Insert Layout details + * @return void **/ function dispLayoutAdminModify() { // Set the layout after getting layout information @@ -193,9 +199,10 @@ $this->setTemplateFile('layout_modify'); } - // deprecated /** - * @brief The first page of the layout admin + * The first page of the layout admin + * @deprecated + * @return void|Object (void : success, Object : fail) **/ function dispLayoutAdminContent() { $path = Context::get('path'); @@ -209,7 +216,11 @@ $this->setTemplateFile('index'); } - // deprecated + /** + * The first page of the mobile layout admin + * @deprecated + * @return void + **/ function dispLayoutAdminMobileContent() { $oLayoutModel = &getModel('layout'); $columnList = array('layout_srl', 'layout', 'module_srl', 'title', 'regdate'); @@ -221,7 +232,8 @@ } /** - * @brief Edit layout codes + * Edit layout codes + * @return void **/ function dispLayoutAdminEdit() { // Set the layout with its information @@ -230,7 +242,7 @@ $oLayoutModel = &getModel('layout'); $layout_info = $oLayoutModel->getLayout($layout_srl); // Error appears if there is no layout information is registered - if(!$layout_info) return $this->dispLayoutAdminContent(); + if(!$layout_info) return $this->dispLayoutAdminInstalledList(); // Get Layout Code $oLayoutModel = &getModel('layout'); @@ -280,7 +292,8 @@ } /** - * @brief Preview a layout + * Preview a layout + * @return void|Object (void : success, Object : fail) **/ function dispLayoutAdminPreview() { $layout_srl = Context::get('layout_srl'); @@ -332,9 +345,10 @@ } - // deprecated /** - * @brief Pop-up details of the layout(conf/info.xml) + * Pop-up details of the layout(conf/info.xml) + * @deprecated + * @return void **/ function dispLayoutAdminInfo() { // Get the layout information @@ -353,9 +367,10 @@ $this->setTemplateFile('layout_detail_info'); } - // deprecated /** - * @brief Modify admin layout of faceoff + * Modify admin layout of faceoff + * @deprecated + * @return void **/ function dispLayoutAdminLayoutModify(){ // Get layout_srl @@ -400,7 +415,11 @@ $this->setTemplateFile('faceoff_layout_edit'); } - // deprecated + /** + * display used images info for faceoff + * @deprecated + * @return void + **/ function dispLayoutAdminLayoutImageList(){ $layout_srl = Context::get('layout_srl'); $oLayoutModel = &getModel('layout'); diff --git a/modules/layout/layout.class.php b/modules/layout/layout.class.php index 387fd8746..e7e0ff13d 100644 --- a/modules/layout/layout.class.php +++ b/modules/layout/layout.class.php @@ -2,13 +2,14 @@ /** * @class layout * @author NHN (developers@xpressengine.com) - * @brief high class of the layout module + * high class of the layout module **/ class layout extends ModuleObject { /** - * @brief Implement if additional tasks are necessary when installing + * Implement if additional tasks are necessary when installing + * @return Object **/ function moduleInstall() { // Create a directory to be used in the layout @@ -18,7 +19,8 @@ } /** - * @brief a method to check if successfully installed + * a method to check if successfully installed + * @return boolean **/ function checkUpdate() { $oDB = &DB::getInstance(); @@ -37,7 +39,8 @@ } /** - * @brief Execute update + * Execute update + * @return Object **/ function moduleUpdate() { $oDB = &DB::getInstance(); @@ -68,7 +71,8 @@ /** - * @brief Re-generate the cache file + * Re-generate the cache file + * @return void **/ function recompileCache() { $path = './files/cache/layout'; diff --git a/modules/layout/layout.model.php b/modules/layout/layout.model.php index 9bdfe4f88..9c279e64f 100644 --- a/modules/layout/layout.model.php +++ b/modules/layout/layout.model.php @@ -3,22 +3,32 @@ * @class layoutModel * @author NHN (developers@xpressengine.com) * @version 0.1 - * @brief Model class of the layout module + * Model class of the layout module **/ class layoutModel extends layout { + /** + * Check user layout temp + * @var string + **/ var $useUserLayoutTemp = null; + /** - * @brief Initialization + * Initialization + * @return void **/ function init() { } - // deprecated /** - * @brief Get a layout list created in the DB + * Get a layout list created in the DB * If you found a new list, it means that the layout list is inserted to the DB + * @deprecated + * @param int $site_srl + * @param string $layout_type (P : PC, M : Mobile) + * @param array $columnList + * @return array layout lists in site **/ function getLayoutList($site_srl = 0, $layout_type="P", $columnList = array()) { if(!$site_srl) { @@ -32,7 +42,12 @@ } /** - * @brief Get layout instance list + * Get layout instance list + * @param int $siteSrl + * @param string $layoutType (P : PC, M : Mobile) + * @param string $layout name of layout + * @param array $columnList + * @return array layout lists in site **/ function getLayoutInstanceList($siteSrl = 0, $layoutType = 'P', $layout = null, $columnList = array()) { @@ -49,8 +64,10 @@ } /** - * @brief Get one of layout information created in the DB + * Get one of layout information created in the DB * Return DB info + XML info of the generated layout + * @param int $layout_srl + * @return object info of layout **/ function getLayout($layout_srl) { // cache controll @@ -78,11 +95,13 @@ if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key,$layout_info); } return $layout_info; - } /** - * @brief Get a layout path + * Get a layout path + * @param string $layout_name + * @param string $layout_type (P : PC, M : Mobile) + * @return string path of layout **/ function getLayoutPath($layout_name, $layout_type = "P") { $layout_parse = explode('.', $layout_name); @@ -100,8 +119,11 @@ } /** - * @brief Get a type and information of the layout + * Get a type and information of the layout * A type of downloaded layout + * @param string $layout_type (P : PC, M : Mobile) + * @param boolean $withAutoinstallInfo + * @return array info of layout **/ function getDownloadedLayoutList($layout_type = "P", $withAutoinstallInfo = false) { if ($withAutoinstallInfo) $oAutoinstallModel = &getModel('autoinstall'); @@ -142,8 +164,8 @@ } /** - * @brief Get a count of layout - * @param $layout_type: a type of layout(P|M) + * Get a count of layout + * @param string $layoutType (P : PC, M : Mobile) * @return int **/ function getInstalledLayoutCount($layoutType = 'P') @@ -153,8 +175,8 @@ } /** - * @brief Get list of layouts directory - * @param $layoutType: a type of layout(P|M) + * Get list of layouts directory + * @param string $layoutType (P : PC, M : Mobile) * @return array **/ function _getInstalledLayoutDirectories($layoutType = 'P') @@ -180,8 +202,12 @@ } /** - * @brief Get information by reading conf/info.xml in the module + * Get information by reading conf/info.xml in the module * It uses caching to reduce time for xml parsing .. + * @param string $layout + * @param object $info + * @param string $layoutType (P : PC, M : Mobile) + * @return object info of layout **/ function getLayoutInfo($layout, $info = null, $layout_type = "P") { if($info) { @@ -441,7 +467,6 @@ } - // header_script $oModuleModel = &getModel('module'); $layout_config = $oModuleModel->getModulePartConfig('layout', $layout_srl); @@ -455,9 +480,10 @@ return $layout_info; } - /** - * @brief Return a list of images which are uploaded on the layout setting page + * Return a list of images which are uploaded on the layout setting page + * @param int $layout_srl + * @return array image list in layout **/ function getUserLayoutImageList($layout_srl){ $path = $this->getUserLayoutImagePath($layout_srl); @@ -465,9 +491,11 @@ return $list; } - /** - * @brief Get ini configurations and make them an array. + * Get ini configurations and make them an array. + * @param int $layout_srl + * @param string $layout_name + * @return array **/ function getUserLayoutIniConfig($layout_srl, $layout_name=null){ $file = $this->getUserLayoutIni($layout_srl); @@ -480,29 +508,36 @@ } /** - * @brief user layout path + * get user layout path + * @param int $layout_srl + * @return string **/ function getUserLayoutPath($layout_srl){ return sprintf("./files/faceOff/%s",getNumberingPath($layout_srl,3)); } /** - * @brief user layout image path + * get user layout image path + * @param int $layout_srl + * @return string **/ function getUserLayoutImagePath($layout_srl){ return $this->getUserLayoutPath($layout_srl). 'images/'; } /** - * @brief css which is set by an administrator on the layout setting page + * css which is set by an administrator on the layout setting page + * @param int $layout_srl + * @return string **/ function getUserLayoutCss($layout_srl){ return $this->getUserLayoutPath($layout_srl). 'layout.css'; } - /** - * @brief Import faceoff css from css module handler + * Import faceoff css from css module handler + * @param int $layout_srl + * @return string **/ function getUserLayoutFaceOffCss($layout_srl){ $src = $this->_getUserLayoutFaceOffCss($layout_srl); @@ -510,25 +545,28 @@ return $src; } - /** - * @brief Import faceoff css from css module handler + * Import faceoff css from css module handler + * @param int $layout_srl + * @return string **/ function _getUserLayoutFaceOffCss($layout_srl){ return $this->getUserLayoutPath($layout_srl). 'faceoff.css'; } /** - * @brief user layout tmp html + * get user layout tmp html + * @param int $layout_srl + * @return string **/ function getUserLayoutTempFaceOffCss($layout_srl){ return $this->getUserLayoutPath($layout_srl). 'tmp.faceoff.css'; } - - /** - * @brief user layout html + * user layout html + * @param int $layout_srl + * @return string **/ function getUserLayoutHtml($layout_srl){ $src = $this->getUserLayoutPath($layout_srl). 'layout.html'; @@ -542,15 +580,18 @@ } /** - * @brief user layout tmp html + * user layout tmp html + * @param int $layout_srl + * @return string **/ function getUserLayoutTempHtml($layout_srl){ return $this->getUserLayoutPath($layout_srl). 'tmp.layout.html'; } - /** - * @brief user layout ini + * user layout ini + * @param int $layout_srl + * @return string **/ function getUserLayoutIni($layout_srl){ $src = $this->getUserLayoutPath($layout_srl). 'layout.ini'; @@ -564,58 +605,75 @@ } /** - * @brief user layout tmp ini + * user layout tmp ini + * @param int $layout_srl + * @return string **/ function getUserLayoutTempIni($layout_srl){ return $this->getUserLayoutPath($layout_srl). 'tmp.layout.ini'; } /** - * @brief user layout cache - * todo It may need to remove the file itself + * user layout cache + * TODO It may need to remove the file itself + * @param int $layout_srl + * @param string $lang_type + * @return string **/ function getUserLayoutCache($layout_srl,$lang_type){ return $this->getUserLayoutPath($layout_srl). "{$lang_type}.cache.php"; } /** - * @brief layout cache + * layout cache + * @param int $layout_srl + * @param string $lang_type + * @return string **/ function getLayoutCache($layout_name,$lang_type){ return sprintf("./files/cache/layout/%s.%s.cache.php",$layout_name,$lang_type); } /** - * @brief default layout ini to prevent arbitrary changes by a user + * default layout ini to prevent arbitrary changes by a user + * @param string $layout_name + * @return string **/ function getDefaultLayoutIni($layout_name){ return $this->getDefaultLayoutPath($layout_name). 'layout.ini'; } /** - * @brief default layout html to prevent arbitrary changes by a user + * default layout html to prevent arbitrary changes by a user + * @param string $layout_name + * @return string **/ function getDefaultLayoutHtml($layout_name){ return $this->getDefaultLayoutPath($layout_name). 'layout.html'; } /** - * @brief default layout css to prevent arbitrary changes by a user + * default layout css to prevent arbitrary changes by a user + * @param string $layout_name + * @return string **/ function getDefaultLayoutCss($layout_name){ return $this->getDefaultLayoutPath($layout_name). 'css/layout.css'; } /** - * @brief default layout path to prevent arbitrary changes by a user + * default layout path to prevent arbitrary changes by a user + * @deprecated + * @return string **/ function getDefaultLayoutPath() { return "./modules/layout/faceoff/"; } - /** - * @brief faceoff is + * faceoff is + * @param string $layout_name + * @return boolean (true : faceoff, false : layout) **/ function useDefaultLayout($layout_name){ $info = $this->getLayoutInfo($layout_name); @@ -623,17 +681,19 @@ else return false; } - /** - * @brief Set user layout as temporary save mode + * Set user layout as temporary save mode + * @param string $flag (default 'temp') + * @return void **/ function setUseUserLayoutTemp($flag='temp'){ $this->useUserLayoutTemp = $flag; } - /** - * @brief Temp file list for User Layout + * Temp file list for User Layout + * @param int $layout_srl + * @return array temp files info **/ function getUserLayoutTempFileList($layout_srl){ $file_list = array( @@ -644,9 +704,10 @@ return $file_list; } - /** - * @brief Saved file list for User Layout + * Saved file list for User Layout + * @param int $layout_srl + * @return array files info **/ function getUserLayoutFileList($layout_srl){ $file_list = array( @@ -664,7 +725,10 @@ } /** - * @brief faceOff related services for the operation run out + * faceOff related services for the operation run out + * @deprecated + * @param object $layout_info + * @return void **/ function doActivateFaceOff(&$layout_info) { $layout_info->faceoff_ini_config = $this->getUserLayoutIniConfig($layout_info->layout_srl, $layout_info->layout); diff --git a/modules/layout/layout.view.php b/modules/layout/layout.view.php index 56926c9e5..6dcda6966 100644 --- a/modules/layout/layout.view.php +++ b/modules/layout/layout.view.php @@ -2,20 +2,22 @@ /** * @class layoutView * @author NHN (developers@xpressengine.com) - * @brief admin view class of the layout module + * admin view class of the layout module **/ class layoutView extends layout { /** - * @brief Initialization + * Initialization + * @return void **/ function init() { $this->setTemplatePath($this->module_path.'tpl'); } /** - * @brief Pop-up layout details(conf/info.xml) + * Pop-up layout details(conf/info.xml) + * @return void **/ function dispLayoutInfo() { // Get the layout information @@ -30,7 +32,8 @@ } /** - * @brief Preview a layout + * Preview a layout + * @return void|Object (void : success, Object : fail) **/ function dispLayoutPreview() { // admin check