示例#1
0
 public function exportExcel(App_Grid_Filter $filter, $exportFileName)
 {
     ob_start();
     //$filter->setRecordsPerPage($rowsPerPage);
     $filter->disableSort();
     parent::Table($filter);
     ob_clean();
     $list = $filter->getList();
     $this->render($list, $filter->getheaderTitles(), $filter->getFields(), $exportFileName);
 }
示例#2
0
 public function exportPdf(App_Grid_Filter $filter, $exportLayout = 'P', $rowsPerPage = 20, $page = 'all', $fileName = '')
 {
     if ((int) $rowsPerPage <= 0) {
         $rowsPerPage = 20;
     }
     ob_start();
     $filter->setRecordsPerPage($rowsPerPage);
     $filter->disableSort();
     parent::Table($filter);
     ob_clean();
     $this->caption = $filter->getCaptionText();
     $this->render($filter, $exportLayout, $page, $fileName);
     //echo $tbl;
 }
示例#3
0
 public function inLineEditTable(App_Grid_Filter $filter, array $list = null)
 {
     return "<form method='post'>" . parent::Table($filter, $list) . "</form>";
 }
示例#4
0
 public function TableSeparate(App_Grid_Filter $filter, array $list = null)
 {
     parent::Table($filter, $list);
 }
示例#5
0
    /**
     * @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;
    }