public function mainNavigation2($beginModule = '') { //$this->view->headLink()->appendStylesheet('/css/express-table/style.css'); $request = Zend_Controller_Front::getInstance()->getRequest(); $currentModule = $request->getModuleName(); $currentControler = $request->getControllerName(); $currentAction = $request->getActionName(); $beginModule = $request->getModuleName(); $config = new Zend_Config_Xml(APPLICATION_PATH . '/configs/navigation-admin.xml', 'nav'); $text = ''; foreach ($config as $module => $data) { if ($module == $beginModule) { $navTexe .= ' <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> ' . $data->label . ' <b class="caret"></b></a> <ul class="dropdown-menu">'; $navTexe .= $this->genMenu($config, $module); $newControllerUrl = $this->view->url('new-controller', 'controller-setting', 'appconfig', array('con' => App_Env::getControllerName(), "mdl" => App_Env::getModuleName(), 'act' => App_Env::getActionName())); $navTexe .= '<li class="divider"></li><li><a class="colorbox-iframe" href="' . $newControllerUrl . '"><i class="glyphicon glyphicon-plus-sign"></i> Add Controler</a></li> ' . '</ul></li>'; } } if ($currentAction != 'index' and $currentAction != '') { $navTexe .= " <li> <a href='/{$currentModule}/{$currentControler}'> {$currentControler} </a> </li>"; $currentAction = ucwords(str_replace("-", " ", $currentAction)); $navTexe .= " <li class='active'> {$currentAction} </li>"; } else { $navTexe .= " <li class='active'> {$currentControler} </li>"; } /* $id = $request->getParam('id',''); if($id != ''){ $model = $this->view->defaultmodel; if($model Instanceof App_Model_Abstract){ $navTexe .= " of id : $id ($model)"; }else{ $navTexe .= " of id : $id "; } }*/ return ' <ol class="breadcrumb">' . '<li><a href="/"> <i class="glyphicon glyphicon-home"></i> หนัาหลัก</a></li>' . $navTexe . '</ol>'; }
function isEditForm() { if (in_array(App_Env::getActionName(), array('edit', 'edit-dialog'))) { return true; } return $this->_iseditform; }
/** * @param string $label * @param string $onclick * @param string $additionalClass * @param string $id * @param bool $disabled * @param string $title * @return string */ public function Zbutton($action, $controller = '', $label = '', $id = '', $disabled = false, $title = '', $additionalClass = '', $userParams = null, array $windowOptions = null) { $module = ''; if (is_array($action)) { $iconclass = isset($action['icon']) ? $action['icon'] : 'ui-icon-bullet'; $controller = isset($action['controller']) ? $action['controller'] : null; $module = isset($action['module']) ? $action['module'] : null; $width = isset($action['width']) ? $action['width'] : null; $title = isset($action['tooltip']) ? $action['tooltip'] : null; $onClickFunction = isset($action['onClickFunction']) ? $action['onClickFunction'] : null; $label = isset($action['label']) ? $action['label'] : null; $id = isset($action['id']) ? $action['id'] : null; $disabled = isset($action['disabled']) ? $action['disabled'] : null; $additionalClass = isset($action['class']) ? $action['class'] : null; $userParams = isset($action['params']) ? $action['params'] : null; $windowOptions = isset($action['windowOptions']) ? $action['windowOptions'] : null; $url = isset($action['url']) ? $action['url'] : null; $class = isset($action['class']) ? $action['class'] : "{$action}-button"; $action = isset($action['action']) ? $action['action'] : null; //if($label=='')$label=$title; //echo $iconclass; //return $iconclass; } //if(strtolower($label) == 'new')$label = ucfirst($action); $req = Zend_Controller_Front::getInstance()->getRequest(); if (trim($controller) == '') { $controller = $req->getControllerName(); } if ($module == '') { $module = $req->getModuleName(); } //$class = "$action-button"; $disabledClass = $disabled ? ' button-disabled ' : ''; $onclick = ''; if ($label == '') { $label = ucfirst($action); } //if($action =='reload')$label = 'reload'; if ($title == '') { $title = "Click to " . ucfirst($action) . " {$controller}."; } if ($id == '') { $id = 'btn_' . $action; } //echo $action; $resource = strtolower("{$module}:{$controller}"); $isAllowed = Sam_Acl::getInstance()->isAllowed($resource, $action); $resourceName = "{$resource}#{$action}"; if ($id == "SaveButton") { if (in_array(App_Env::getActionName(), array('new', 'new-dialog'))) { $isAllowed = Sam_Acl::getInstance()->isAllowed($resource, "new"); } else { $isAllowed = Sam_Acl::getInstance()->isAllowed($resource, "edit"); } } else { } // echo (int)$isAllowed,"<br/>"; $is_refresh = false; if ($action == 'reload') { $action = null; $is_refresh = true; } if ($isAllowed and $disabled == false) { if ($url != '') { $link = $url; $onclick = " onclick=\"location.href='{$link}'\" "; } else { if ($onClickFunction != '') { $onclick = $onClickFunction; } else { if ($windowOptions != null) { //if(!isset($userParams["print"])){ // $userParams["print"]='html'; //} $userParams["mode"] = 'window'; if ($url == '') { $link = $this->view->url($action, $controller, $module, $userParams); } else { $link = $url; } $wwidth = isset($windowOptions['width']) ? $windowOptions['width'] : ''; $wheight = isset($windowOptions['height']) ? $windowOptions['height'] : ''; if ($windowOptions['type'] == 'print') { $id = 'PrintButton'; $onclick = "onclick=\"window.print();\""; } else { $onclick = "onclick=\"openWindows('{$link}','{$id}','{$wwidth}','{$wheight}')\""; } } elseif ($id == 'PrintButton') { $userParams["mode"] = 'window'; $userParams["print"] = 'html'; if ($url == '') { $link = $this->view->url($action, $controller, $module, $userParams); } else { $link = $url; } $onclick = "onclick=\"window.print();\""; } else { if ($is_refresh) { //$link = $this->view->url('SSSSS',$controller,null,$userParams,true); $x = uniqid(); $onclick = "onclick=\"location.href='?x={$x}&filter=reset'\""; } elseif ($action != '') { $link = $this->view->url($action, $controller, null, $userParams, true); $onclick = "onclick=\"location.href='{$link}'\""; } else { $onclick = ''; } } } } } else { $disabled = true; } if ($disabled == true) { $disabledClass = ' button-disabled '; $disabled = 'disabled="disabled"'; } if ($action == 'index' or $action == 'back') { //$iconclass = "glyphicon glyphicon-refresh"; } if ($action == 'close' or $action == 'back') { //$iconclass = "glyphicon glyphicon-refresh"; } if ($is_refresh) { $iconclass = "glyphicon glyphicon-refresh"; } elseif ($id == "SaveButton" or $id == "DownloadButton" or $id == "SaveTransaction") { $iconclass = "glyphicon glyphicon-floppy-disk"; } elseif ($id == "ResetButton" or $class == 'reset' or $Id == "ReStart" or $id == 'forn-search-button-refresh') { $iconclass = "glyphicon glyphicon-refresh"; } elseif ($id == "CancelButton") { $iconclass = "glyphicon glyphicon-remove"; } elseif ($id == "EditButton" or $id == "edit") { $iconclass = "glyphicon glyphicon-pencil"; } elseif ($id == "CloseButton") { $iconclass = "glyphicon glyphicon-remove-circle"; } elseif ($id == "ExportButton") { $iconclass = "glyphicon glyphicon-download"; } elseif ($id == "PrintButton") { $iconclass = "glyphicon glyphicon-print"; $label = 'Print'; } elseif ($class == 'apply' or $id == 'forn-search-button-submit') { $iconclass = "glyphicon glyphicon-search"; $title = 'search'; $label = 'search'; } elseif ($id == 'CloseToIIndexButton' or $id == 'CloseToIndexButton') { $iconclass = "glyphicon glyphicon-chevron-left"; $link = App_View_Helper_Table::getToIndexLink($this->view, null, null, null, array('action' => $action)); $onclick = "onclick=\"location.href='{$link}'\""; } elseif ($id == "DeleteButton") { $iconclass = "glyphicon glyphicon-trash"; } elseif ($id == "NewButton") { $iconclass = "glyphicon glyphicon-plus"; } if (trim($iconclass) == '') { $iconclass = "glyphicon glyphicon-plus"; } if ($width == '') { $width = '300'; } $style = " style='width: {$width} ;' "; /* $output =<<<button <input type='button' value='{$label}' id='{$id}' name='$id' $onclick $disabled $width title='{$this->view->escape($title)}' class='btn {$class} {$disabledClass} {$additionalClass}' /> button; $output2 =<<<buttonImg <img type="button" value="{$label}" id='{$id}' name='$id' $onclick $disabled title='{$this->view->escape($title)}' class=' {$class} {$disabledClass} {$additionalClass}' /> buttonImg; */ $output3 = <<<buttonImg \t\t<a resource='{$resourceName}' id='{$id}' name='{$id}' {$onclick} {$disabled} {$style} title='{$this->view->escape($title)}' class='btn btn-default btn-xs ' > \t\t<i class="{$iconclass}"></i> {$label} \t\t</a> \t\t\t\t buttonImg; return $output3; }