add phpDoc comment in menu module

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10792 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ovclas 2012-06-25 09:30:08 +00:00
parent e7e74da1f8
commit 19a7be5b1f
5 changed files with 296 additions and 157 deletions

View file

@ -1,25 +1,45 @@
<?php
/**
* @class menuAdminController
* menuAdminController class
* admin controller class of the menu module
*
* @author NHN (developers@xpressengine.com)
* @brief admin controller class of the menu module
**/
* @package /modules/menu
* @version 0.1
*/
class menuAdminController extends menu {
/**
* menu number
* @var int
*/
var $menuSrl = null;
/**
* item key list
* @var array
*/
var $itemKeyList = array();
/**
* map
* @var array
*/
var $map = array();
/**
* checked
* @var array
*/
var $checked = array();
/**
* @brief Initialization
**/
* Initialization
* @return void
*/
function init() {
}
/**
* @brief Add a menu
**/
* Add a menu
* @return void|object
*/
function procMenuAdminInsert() {
// List variables
$site_module_info = Context::get('site_module_info');
@ -42,8 +62,9 @@
}
/**
* @brief Change the menu title
**/
* Change the menu title
* @return void|object
*/
function procMenuAdminUpdate() {
// List variables
$args->title = Context::get('title');
@ -61,9 +82,9 @@
}
/**
* @brief Delete menu
* Delete menu_item and xml cache files
**/
* Delete menu process method
* @return void|Object
*/
function procMenuAdminDelete() {
$menu_srl = Context::get('menu_srl');
@ -83,6 +104,11 @@
}
}
/**
* Delete menu
* Delete menu_item and xml cache files
* @return Object
*/
function deleteMenu($menu_srl) {
// Delete cache files
$cache_list = FileHandler::readDir("./files/cache/menu","",false,true);
@ -108,8 +134,9 @@
}
/**
* @brief Add an item to the menu
**/
* Add an item to the menu
* @return void
*/
function procMenuAdminInsertItem() {
// List variables to insert
$source_args = Context::getRequestVars();
@ -234,8 +261,9 @@
}
/**
* @brief Delete menu item(menu of the menu)
**/
* Delete menu item(menu of the menu)
* @return void|Object
*/
function procMenuAdminDeleteItem() {
// List variables
$args = Context::gets('menu_srl','menu_item_srl');
@ -279,8 +307,9 @@
}
/**
* @brief Move menu items
**/
* Move menu items
* @return void
*/
function procMenuAdminMoveItem() {
$menu_srl = Context::get('menu_srl');
$mode = Context::get('mode');
@ -293,8 +322,9 @@
}
/**
* @brief Arrange menu items
**/
* Arrange menu items
* @return void|object
*/
function procMenuAdminArrangeItem()
{
$this->menuSrl = Context::get('menu_srl');
@ -356,6 +386,13 @@
}
}
/**
* Set parent number to child
* @param int $parent_srl
* @param int $child_index
* @param object $target
* @return void
*/
function _setParent($parent_srl, $child_index, &$target)
{
$child_srl = $this->itemKeyList[$child_index];
@ -372,6 +409,11 @@
//return $target;
}
/**
* move item with sub directory(recursive)
* @param object $result
* @return void
*/
function _recursiveMoveMenuItem($result)
{
$i = 0;
@ -386,6 +428,15 @@
}
}
/**
* move menu item
* @param int $menu_srl
* @param int $parent_srl
* @param int $source_srl
* @param int $target_srl
* @param string $mode 'move' or 'insert'
* @return void
*/
function moveMenuItem($menu_srl,$parent_srl,$source_srl,$target_srl,$mode){
// Get the original menus
$oMenuAdminModel = &getAdminModel('menu');
@ -429,11 +480,12 @@
}
/**
* @brief Update xml file
* Update xml file
* XML file is not often generated after setting menus on the admin page\n
* For this occasional cases, manually update was implemented. \n
* It looks unnecessary at this moment however no need to eliminate the feature. Just leave it.
**/
* @return void
*/
function procMenuAdminMakeXmlFile() {
// Check input value
$menu_srl = Context::get('menu_srl');
@ -449,8 +501,9 @@
}
/**
* @brief Register a menu image button
**/
* Register a menu image button
* @return void
*/
function procMenuAdminUploadButton() {
$menu_srl = Context::get('menu_srl');
$menu_item_srl = Context::get('menu_item_srl');
@ -479,8 +532,9 @@
}
/**
* @brief Remove the menu image button
**/
* Remove the menu image button
* @return void
*/
function procMenuAdminDeleteButton() {
$menu_srl = Context::get('menu_srl');
$menu_item_srl = Context::get('menu_item_srl');
@ -492,8 +546,9 @@
}
/**
* @brief get all act list for admin menu
**/
* Get all act list for admin menu
* @return void
*/
function procMenuAdminAllActList() {
$oModuleModel = &getModel('module');
$installed_module_list = $oModuleModel->getModulesXmlInfo();
@ -512,8 +567,9 @@
}
/**
* @brief get all act list for admin menu
**/
* Get all act list for admin menu
* @return void|object
*/
function procMenuAdminInsertItemForAdminMenu()
{
$requestArgs = Context::getRequestVars();
@ -579,8 +635,10 @@
}
/**
* @brief Generate XML file for menu and return its location
**/
* Generate XML file for menu and return its location
* @param int $menu_srl
* @return string
*/
function makeXmlFile($menu_srl) {
// Return if there is no information when creating the xml file
if(!$menu_srl) return;
@ -687,10 +745,15 @@
}
/**
* @brief Create xml data recursively looping for array nodes by referencing to parent_srl
* Create xml data recursively looping for array nodes by referencing to parent_srl
* menu xml file uses a tag named "node" and this XML configures menus on admin page.
* (Implement tree menu by reading the xml file in tree_menu.js)
**/
* @param array $source_node
* @param array $tree
* @param int $site_srl
* @param string $domain
* @return string
*/
function getXmlTree($source_node, $tree, $site_srl, $domain) {
if(!$source_node) return;
@ -766,11 +829,16 @@
}
/**
* @brief Return php code converted from nodes in an array
* Return php code converted from nodes in an array
* Although xml data can be used for tpl, menu to menu, it needs to use javascript separately
* By creating cache file in php and then you can get menu information without DB
* This cache includes in ModuleHandler::displayContent() and then Context::set()
**/
* @param array $source_node
* @param array $tree
* @param int $site_srl
* @param string $domain
* @return array
*/
function getPhpCacheCode($source_node, $tree, $site_srl, $domain) {
$output = array("buff"=>"", "url_list"=>array());
if(!$source_node) return $output;
@ -868,9 +936,11 @@
}
/**
* @brief Mapping menu and layout
* Mapping menu and layout
* When setting menu on the layout, map the default layout
**/
* @param int $layout_srl
* @param array $menu_srl_list
*/
function updateMenuLayout($layout_srl, $menu_srl_list) {
if(!count($menu_srl_list)) return;
// Delete the value of menu_srls
@ -888,8 +958,10 @@
}
/**
* @brief Register a menu image button
**/
* Register a menu image button
* @param object $args
* @return array
*/
function _uploadButton($args)
{
// path setting

View file

@ -1,22 +1,25 @@
<?php
/**
* @class menuAdminModel
* @author NHN (developers@xpressengine.com)
* @version 0.1
* @brief admin model class of the menu module
**/
*
* @author NHN (developers@xpressengine.com)
* @package /modules/menu
* @version 0.1
*/
class menuAdminModel extends menu {
/**
* @brief Initialization
**/
* Initialization
* @return void
*/
function init() {
}
/**
* @brief Get a list of all menus
**/
* Get a list of all menus
* @param object $obj
* @return object
*/
function getMenuList($obj) {
if(!$obj->site_srl) {
$site_module_info = Context::get('site_module_info');
@ -36,8 +39,10 @@
}
/**
* @brief Return all menus
**/
* Return all menus
* @param int $site_srl
* @return array
*/
function getMenus($site_srl = null) {
if(!isset($site_srl)) {
$site_module_info = Context::get('site_module_info');
@ -53,9 +58,11 @@
}
/**
* @brief Get information of a new menu from the DB
* Get information of a new menu from the DB
* Return DB and XML information of the menu
**/
* @param int $menu_srl
* @return object
*/
function getMenu($menu_srl) {
// Get information from the DB
$args->menu_srl = $menu_srl;
@ -69,9 +76,11 @@
}
/**
* @brief Get information of a new menu from the DB, search condition is menu title
* Get information of a new menu from the DB, search condition is menu title
* Return DB and XML information of the menu
**/
* @param string $title
* @return object
*/
function getMenuByTitle($title) {
// Get information from the DB
$args->title = $title;
@ -90,9 +99,11 @@
}
/**
* @brief Return item information of the menu_srl
* Return item information of the menu_srl
* group_srls uses a seperator with comma(,) and converts to an array by explode
**/
* @param int $menu_item_srl
* @return object
*/
function getMenuItemInfo($menu_item_srl) {
// Get the menu information if menu_item_srl exists
$args->menu_item_srl = $menu_item_srl;
@ -113,8 +124,9 @@
}
/**
* @brief Return item information of the menu_srl
**/
* Return item information of the menu_srl
* @return void
*/
function getMenuAdminItemInfo()
{
$menuItemSrl = Context::get('menu_item_srl');
@ -169,6 +181,13 @@
$this->add('menu_item', $menuItem);
}
/**
* Return menu item list by menu number
* @param int $menu_srl
* @param int $parent_srl
* @param array $columnList
* @return object
*/
function getMenuItems($menu_srl, $parent_srl = null, $columnList = array())
{
$args->menu_srl = $menu_srl;
@ -179,7 +198,10 @@
}
/**
* @brief Return menu name in each language to support multi-language
* Return menu name in each language to support multi-language
* @param string $source_name
* @param int $site_srl
* @return array
*/
function getMenuItemNames($source_name, $site_srl = null) {
if(!$site_srl) {
@ -192,9 +214,10 @@
}
/**
* @brief Get a template by using the menu_srl and retrun.
* Get a template by using the menu_srl and retrun.
* Return html after compiling tpl on the server in order to add menu information on the admin page
**/
* @return void
*/
function getMenuAdminTplInfo() {
// Get information on the menu for the parameter settings
$menu_item_srl = Context::get('menu_item_srl');
@ -237,7 +260,9 @@
/**
* @brief when menu add in sitemap, select module list
* this menu showing with trigger
**/
* @param int $site_srl
* @return array
*/
function getModuleListInSitemap($site_srl = 0)
{
$oModuleModel = &getModel('module');

View file

@ -1,23 +1,27 @@
<?php
/**
* @class menuAdminView
* menuAdminView class
* admin view class of the menu module
*
* @author NHN (developers@xpressengine.com)
* @brief admin view class of the menu module
**/
* @package /modules/menu
* @version 0.1
*/
class menuAdminView extends menu {
var $tmpMenu = null;
/**
* @brief Initialization
**/
* Initialization
* @return void
*/
function init() {
$this->setTemplatePath($this->module_path.'tpl');
}
/**
* @brief The first page of the menu admin
**/
* The first page of the menu admin
* @return void
*/
function dispMenuAdminContent() {
// Get a list of registered menus
$obj->page = Context::get('page');
@ -42,8 +46,9 @@
}
/**
* @brief Page to insert a menu
**/
* Page to insert a menu
* @return void
*/
function dispMenuAdminInsert() {
// Set the menu with menu information
$menu_srl = Context::get('menu_srl');
@ -59,8 +64,9 @@
}
/**
* @brief Menu admin page
**/
* Menu admin page
* @return void
*/
function dispMenuAdminManagement() {
// Get information of the menu
$menu_srl = Context::get('menu_srl');
@ -83,9 +89,10 @@
/**
* @brief Display a mid list to be able to select on the menu
* @perphaps this method not use
**/
* Display a mid list to be able to select on the menu
* Perphaps this method not use
* @return void
*/
function dispMenuAdminMidList() {
$oModuleModel = &getModel('module');
// Get a list of module categories
@ -114,8 +121,9 @@
}
/**
* @brief Site map admin menu index page
**/
* Site map admin menu index page
* @return void
*/
function dispMenuAdminSiteMap()
{
Context::loadLang(_XE_PATH_.'modules/document/lang/');
@ -187,6 +195,11 @@
$this->setTemplateFile('sitemap');
}
/**
* Setting menu information(recursive)
* @param array $menu
* @return void
*/
function _menuInfoSetting(&$menu)
{
$oModuleModel = &getModel('module');
@ -211,6 +224,11 @@
}
}
/**
* Tree-shaped sorting
* @param array $menuItems
* @return array
*/
function _arrangeMenuItem($menuItems)
{
if(is_array($menuItems))

View file

@ -1,15 +1,17 @@
<?php
/**
* @class menu
* menu class
* high class of the menu module
*
* @author NHN (developers@xpressengine.com)
* @brief high class of the menu module
**/
* @package /modules/menu
* @version 0.1
*/
class menu 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 use menu
FileHandler::makeDir('./files/cache/menu');
@ -18,8 +20,9 @@
}
/**
* @brief a method to check if successfully installed
**/
* A method to check if successfully installed
* @return bool
*/
function checkUpdate() {
$oDB = &DB::getInstance();
// 2009. 02. 11 menu added to the table site_srl
@ -31,8 +34,9 @@
}
/**
* @brief Execute update
**/
* Execute update
* @return Object
*/
function moduleUpdate() {
$oDB = &DB::getInstance();
// 2009. 02. 11 menu added to the table site_srl
@ -49,8 +53,9 @@
}
/**
* @brief Re-generate the cache file
**/
* Re-generate the cache file
* @return void
*/
function recompileCache() {
$oMenuAdminController = &getAdminController('menu');
// Wanted list of all the blog module

View file

@ -1,8 +1,23 @@
<?php
/**
* menuMobile class
* mobile class of the menu module
*
* @author NHN (developers@xpressengine.com)
* @package /modules/menu
* @version 0.1
*/
class menuMobile extends moduleObject {
/**
* Result data list
* @var array
*/
var $result = array();
/**
* Menu depth arrange
* @return void
*/
function straightenMenu($menu_item, $depth)
{
if(!$menu_item['link']) return;
@ -17,6 +32,10 @@ class menuMobile extends moduleObject {
}
}
/**
* Display menu
* @return void
*/
function dispMenuMenu() {
$menu_srl = Context::get('menu_srl');
$oAdminModel =& getAdminModel('menu');