db = $db; } static function addPaginator($data,$ctl,\Zend_Controller_Request_Abstract $request = NULL,$limit = 10) { if(empty($request)) { $request = $ctl->getRequest(); $page = $request->getParam('page'); $view = $ctl->view; }else{ $page = $request->getParam('page'); $view = $ctl; } $paginator = \Zend_Paginator::factory($data); $paginator->setCurrentPageNumber($page); $paginator->setItemCountPerPage($limit); $paginator->setView($view); \Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); $view->paginator = $paginator; } static function Msg($type,$content,$url=''){ $html = '
'."\r\n"; $html.= '×'."\r\n"; $html.= $content."\r\n"; $html.= '
'."\r\n"; if(!empty($url)) { if($url == -1){ $html.= ''."\r\n"; }elseif($url == 0){ }else{ $html.= ''."\r\n"; } } return $html; } static function Error($content,$type='',$url=''){ if(empty($type)) { $AlertType = "alert-error"; }else{ $AlertType = $type; } $html = '
'."\r\n"; $html.= '×'."\r\n"; if(!is_array($content)) { $html.= '

'.$content.'

'."\r\n"; }else{ $html.= ''."\r\n"; } $html.= '
'."\r\n"; return $html; } static function User($param){ $auth = \Zend_Auth::getInstance(); if($auth->hasIdentity()) { $user = $auth->getIdentity(); return $user->$param; }else{ return false; } } static function Dump($data,$exit = true){ echo "
";
		var_dump($data);
		echo "
"; if($exit) { exit(); } } static function Post(\Zend_Controller_Action $ctl,$msg,$url=""){ if(empty($msg)) { return false; } if(!is_array($msg)) { $msg = array('content'=>$msg,'url'=>$url); } $helper = new \Zend_Controller_Action_HelperBroker($ctl); $helper->layout->setLayout('layout'); $helper->viewRenderer->setNoRender(); echo $ctl->view->partial('post-message.phtml', $msg); return true; } static function getHostLink() { $protocol = "http"; if(strpos(strtolower($_SERVER['SERVER_PROTOCOL']),"https")) { $protocol = "https"; } return $protocol."://".$_SERVER['SERVER_NAME']; } }