add doi actions
This commit is contained in:
parent
bb4eacce87
commit
a8cdafb719
File diff suppressed because it is too large
Load Diff
|
@ -19,9 +19,7 @@ $this->theme->AppendPlus($this,'colorbox');
|
|||
<li><a href="/admin/data/doi">浏览所有</a></li>
|
||||
<?php if(!empty($this->uuid)) {?>
|
||||
<li class="active"><a href="javascript:void(0);">编辑DOI</a></li>
|
||||
<?php }else{ ?>
|
||||
<li class="active"><a href="/admin/data/doi/ac/add">添加新DOI</a></li>
|
||||
<?php } ?>
|
||||
<?php }?>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="">
|
||||
|
@ -62,7 +60,7 @@ $this->theme->AppendPlus($this,'colorbox');
|
|||
<input type="text" id="title" name="title" value="<?= isset($this->data['title']) ? $this->data['title']:"" ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<?php if(empty($this->data['info'])) {?>
|
||||
<?php if(empty($this->data['info']) || !is_array($this->data['info'])) {?>
|
||||
<div class="control-group infocontrol" id="info1">
|
||||
<label class="control-label" for="">info</label>
|
||||
<div class="controls">
|
||||
|
@ -72,7 +70,23 @@ $this->theme->AppendPlus($this,'colorbox');
|
|||
</div>
|
||||
</div>
|
||||
<?php }else{ ?>
|
||||
|
||||
<?php
|
||||
$index = 0;
|
||||
foreach($this->data['info'] as $k=>$v){
|
||||
$index ++;
|
||||
?>
|
||||
<div class="control-group infocontrol">
|
||||
<label class="control-label">info</label>
|
||||
<div class="controls">
|
||||
<input type="text" name="info[<?= $k ?>][author]" value="<?= $v['author'] ?>" placeholder="作者" />
|
||||
<input type="text" name="info[<?= $k ?>][organization]" value="<?= $v['organization'] ?>" placeholder="单位" />
|
||||
<input type="text" name="info[<?= $k ?>][order]" value="<?= $v['order'] ?>" placeholder="排序" />
|
||||
<?php if($index>1){ ?>
|
||||
<a href="javascript:void(0);" onclick="RmInput(this)"> -删除</a>
|
||||
<?php }?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
|
|
|
@ -1,80 +1,79 @@
|
|||
<?php
|
||||
$this->headTitle($this->config->title->site);
|
||||
$this->headTitle($this->config->title->author);
|
||||
$this->headTitle()->setSeparator(' - ');
|
||||
$this->breadcrumb('<a href="/">首页</a>');
|
||||
$this->breadcrumb('<a href="/admin/data">数据管理</a>');
|
||||
$this->breadcrumb('DOI');
|
||||
$this->breadcrumb()->setSeparator(' > ');
|
||||
$this->theme->AppendPlus($this,'colorbox');
|
||||
$this->theme->AppendPlus($this,'admin_plugin');
|
||||
?>
|
||||
<style>
|
||||
table thead tr th {background:#EBF2F6;}
|
||||
</style>
|
||||
<div class="row-fluid">
|
||||
<div class="span2">
|
||||
<?= $this->partial('data/left.phtml'); ?>
|
||||
</div>
|
||||
<div class="span10">
|
||||
<div>
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a href="/admin/data/doi">浏览所有</a></li>
|
||||
<li><a href="/admin/data/doi/ac/add">添加新DOI</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div>
|
||||
<div class="input-append">
|
||||
<form id="datasearch" class="search_form" action="">
|
||||
<input type="text" id="keyword" name="q" value="<?php if(!empty($this->q)) echo $this->q; ?>" />
|
||||
<button type="submit" class="btn" id="search_btn">搜索</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php if(!empty($this->error)) { ?>
|
||||
<?= $this->error ?>
|
||||
<?php } ?>
|
||||
<?php if(!empty($this->msg)) { ?>
|
||||
<?= $this->msg ?>
|
||||
<?php } else{ ?>
|
||||
<div id="datalist">
|
||||
<?php if (count($this->paginator)): ?>
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>UUID</th>
|
||||
<th>元数据</th>
|
||||
<th>DOI</th>
|
||||
<th width="70">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $autoindex=0;
|
||||
foreach ($this->paginator as $item):
|
||||
$autoindex++;?>
|
||||
<tr id="DataLine_<?= $item['id']?>">
|
||||
<td><?= $item['uuid'] ?></td>
|
||||
<td><?= $item['title'] ?></td>
|
||||
<td><?= $item['doi'] ?></td>
|
||||
<td>
|
||||
<a href="/admin/data/fund/ac/edit/id/<?= $item['id']?>">编辑</a>
|
||||
<a href="javascript:void(0);" onclick="onedel(<?= $item['id']?>)" id="delbtn_<?= $item['id']?>">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
<div class="pagenavi"><?= $this->paginator; ?></div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<!-- //页面内容 -->
|
||||
<script>
|
||||
var info = {
|
||||
btn_prefix : "delbtn_",
|
||||
item_prefix : "DataLine_",
|
||||
url : "/admin/data/doi/ac/del"
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
$this->headTitle($this->config->title->site);
|
||||
$this->headTitle($this->config->title->author);
|
||||
$this->headTitle()->setSeparator(' - ');
|
||||
$this->breadcrumb('<a href="/">首页</a>');
|
||||
$this->breadcrumb('<a href="/admin/data">数据管理</a>');
|
||||
$this->breadcrumb('DOI');
|
||||
$this->breadcrumb()->setSeparator(' > ');
|
||||
$this->theme->AppendPlus($this,'colorbox');
|
||||
$this->theme->AppendPlus($this,'admin_plugin');
|
||||
?>
|
||||
<style>
|
||||
table thead tr th {background:#EBF2F6;}
|
||||
</style>
|
||||
<div class="row-fluid">
|
||||
<div class="span2">
|
||||
<?= $this->partial('data/left.phtml'); ?>
|
||||
</div>
|
||||
<div class="span10">
|
||||
<div>
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a href="/admin/data/doi">浏览所有</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div>
|
||||
<div class="input-append">
|
||||
<form id="datasearch" class="search_form" action="">
|
||||
<input type="text" id="keyword" name="q" value="<?php if(!empty($this->q)) echo $this->q; ?>" />
|
||||
<button type="submit" class="btn" id="search_btn">搜索</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php if(!empty($this->error)) { ?>
|
||||
<?= $this->error ?>
|
||||
<?php } ?>
|
||||
<?php if(!empty($this->msg)) { ?>
|
||||
<?= $this->msg ?>
|
||||
<?php } else{ ?>
|
||||
<div id="datalist">
|
||||
<?php if (count($this->paginator)): ?>
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>UUID</th>
|
||||
<th>元数据</th>
|
||||
<th>DOI</th>
|
||||
<th width="70">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $autoindex=0;
|
||||
foreach ($this->paginator as $item):
|
||||
$autoindex++;?>
|
||||
<tr id="DataLine_<?= $item['id']?>">
|
||||
<td><?= $item['uuid'] ?></td>
|
||||
<td><?= $item['title'] ?></td>
|
||||
<td><?= $item['doi'] ?></td>
|
||||
<td>
|
||||
<a href="/admin/data/doi/ac/edit/uuid/<?= $item['uuid']?>">编辑</a>
|
||||
<a href="javascript:void(0);" onclick="onedel(<?= $item['id']?>)" id="delbtn_<?= $item['id']?>">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
<div class="pagenavi"><?= $this->paginator; ?></div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<!-- //页面内容 -->
|
||||
<script>
|
||||
var info = {
|
||||
btn_prefix : "delbtn_",
|
||||
item_prefix : "DataLine_",
|
||||
url : "/admin/data/doi/ac/del"
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -1,153 +1,179 @@
|
|||
<?php
|
||||
class Doi extends Zend_Controller_Plugin_Abstract
|
||||
{
|
||||
private $db; //传入PDO对象.
|
||||
private $auth = NULL; //Zend_Auth 对象
|
||||
|
||||
//使用到的公共变量
|
||||
public $tbl_doi = "datadoi";
|
||||
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
function fetch()
|
||||
{
|
||||
$sql = "SELECT * FROM ".$this->tbl_doi." ORDER BY id DESC";
|
||||
$rs = $this->db->query($sql);
|
||||
$rows = $rs->fetchAll();
|
||||
return $rows;
|
||||
}
|
||||
|
||||
function add($data){
|
||||
include_once("helper/dbh.php");
|
||||
$dbh = new dbh($this->db);
|
||||
$this->data_process_in($data);
|
||||
include_once("helper/view.php");
|
||||
view::Dump($data);
|
||||
return $dbh->insert($this->tbl_doi,$data);
|
||||
}
|
||||
|
||||
function update($data,$uuid){
|
||||
$doi_info = $this->view($uuid);
|
||||
if(!$doi_info)
|
||||
{
|
||||
$this->data_process_in($data);
|
||||
include_once("helper/view.php");
|
||||
view::Dump($data);
|
||||
include_once("helper/dbh.php");
|
||||
$dbh = new dbh($this->db);
|
||||
if(is_numeric($uuid))
|
||||
{
|
||||
$condition = " id=$uuid ";
|
||||
}else{
|
||||
$condition = " uuid='$uuid' ";
|
||||
}
|
||||
$state = $dbh->update($this->tbl_doi,$data,$condition,true);
|
||||
|
||||
if( $state == true)
|
||||
{
|
||||
return true;
|
||||
}else{
|
||||
return $state;
|
||||
}
|
||||
}else{
|
||||
$this->add($data);
|
||||
}
|
||||
}
|
||||
|
||||
function data_process_in(&$data){
|
||||
$authors = array();
|
||||
$orgs = array();
|
||||
foreach($data['info'] as $k=>$v)
|
||||
{
|
||||
$authors[$v['order']] = $v['author'];
|
||||
$orgs[$v['order']] = $v['organization'];
|
||||
}
|
||||
$authors = "{".join(",",$authors)."}";
|
||||
$orgs = "{".join(",",$orgs)."}";
|
||||
$data['authors'] = $authors;
|
||||
$data['organization'] = $orgs;
|
||||
unset($data['info']);
|
||||
}
|
||||
|
||||
function view($id)
|
||||
{
|
||||
if(is_numeric($id))
|
||||
{
|
||||
$sql = "SELECT * FROM ".$this->tbl_doi." WHERE id=$id";
|
||||
}else{
|
||||
$sql = "SELECT * FROM ".$this->tbl_doi." WHERE uuid='$id'";
|
||||
}
|
||||
$rs = $this->db->query($sql);
|
||||
$row = $rs->fetch();
|
||||
return $row;
|
||||
}
|
||||
|
||||
function _getParams(Zend_Controller_Request_Abstract $request)
|
||||
{
|
||||
$data = array(
|
||||
'doi' => trim($request->getParam('doi')),
|
||||
'uuid' => trim($request->getParam('uuid')),
|
||||
'publisher' => trim($request->getParam('publisher')),
|
||||
'url' => trim($request->getParam('url')),
|
||||
'title' => trim($request->getParam('title')),
|
||||
'info'=>$this->checkinfo($_POST['info'])
|
||||
);
|
||||
if(!is_array($data['info'])){
|
||||
return $data['info'];
|
||||
}else{
|
||||
$data['info'] = $this->sksort($data['info'],"order",SORT_DESC);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
function checkinfo($info){
|
||||
if(!is_array($info)){
|
||||
return NULL;
|
||||
}
|
||||
foreach($info as $k=>$v)
|
||||
{
|
||||
if(empty($v['author']) && empty($v['organization']) && empty($v['order']))
|
||||
{
|
||||
unset($info[$k]);
|
||||
}else{
|
||||
if(empty($v['author']))
|
||||
{
|
||||
return "请输入 $k 中的作者";
|
||||
}
|
||||
if(empty($v['organization']))
|
||||
{
|
||||
return "请输入 $k 中的单位";
|
||||
}
|
||||
if(empty($v['order']))
|
||||
{
|
||||
return "请输入 $k 中的排序";
|
||||
}
|
||||
}
|
||||
}
|
||||
return $info;
|
||||
}
|
||||
|
||||
function sksort($array,$key,$type=SORT_DESC) {
|
||||
$sortArray = array();
|
||||
|
||||
foreach($array as $v){
|
||||
foreach($v as $key=>$value){
|
||||
if(!isset($sortArray[$key])){
|
||||
$sortArray[$key] = array();
|
||||
}
|
||||
$sortArray[$key][] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
if(array_multisort($sortArray[$key],$type,$array))
|
||||
{
|
||||
return $array;
|
||||
}else{
|
||||
return $array;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
<?php
|
||||
class Doi extends Zend_Controller_Plugin_Abstract
|
||||
{
|
||||
private $db; //传入PDO对象.
|
||||
private $auth = NULL; //Zend_Auth 对象
|
||||
|
||||
//使用到的公共变量
|
||||
public $tbl_doi = "datadoi";
|
||||
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
function fetch()
|
||||
{
|
||||
$sql = "SELECT * FROM ".$this->tbl_doi." ORDER BY id DESC";
|
||||
$rs = $this->db->query($sql);
|
||||
$rows = $rs->fetchAll();
|
||||
return $rows;
|
||||
}
|
||||
|
||||
function add($data){
|
||||
include_once("helper/dbh.php");
|
||||
$dbh = new dbh($this->db);
|
||||
$this->data_process_in($data);
|
||||
//include_once("helper/view.php");
|
||||
//view::Dump($data);
|
||||
return $dbh->insert($this->tbl_doi,$data);
|
||||
}
|
||||
|
||||
function update($data,$uuid){
|
||||
$doi_info = $this->view($uuid);
|
||||
if($doi_info == false)
|
||||
{
|
||||
return $this->add($data);
|
||||
}else {
|
||||
$this->data_process_in($data);
|
||||
//include_once("helper/view.php");
|
||||
//view::Dump($data);
|
||||
include_once("helper/dbh.php");
|
||||
$dbh = new dbh($this->db);
|
||||
if(is_numeric($uuid))
|
||||
{
|
||||
$condition = " id=$uuid ";
|
||||
}else{
|
||||
$condition = " uuid='$uuid' ";
|
||||
}
|
||||
$state = $dbh->update($this->tbl_doi,$data,$condition,true);
|
||||
|
||||
if( $state == true)
|
||||
{
|
||||
return true;
|
||||
}else{
|
||||
return $state;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function data_process_in(&$data){
|
||||
$authors = array();
|
||||
$orgs = array();
|
||||
foreach($data['info'] as $k=>$v)
|
||||
{
|
||||
$authors[$v['order']] = $v['author'];
|
||||
$orgs[$v['order']] = $v['organization'];
|
||||
}
|
||||
$authors = "{".join(",",$authors)."}";
|
||||
$orgs = "{".join(",",$orgs)."}";
|
||||
$data['authors'] = $authors;
|
||||
$data['organization'] = $orgs;
|
||||
unset($data['info']);
|
||||
}
|
||||
|
||||
function data_process_out(&$data){
|
||||
$authors = str_replace("{",'',$data['authors']);
|
||||
$authors = str_replace("}",'',$authors);
|
||||
$authors = split(",",$authors);
|
||||
$orgs = str_replace("{",'',$data['organization']);
|
||||
$orgs = str_replace("}",'',$orgs);
|
||||
$orgs = split(",",$orgs);
|
||||
$info = array();
|
||||
foreach($authors as $k=>$v)
|
||||
{
|
||||
$info[$k] = array(
|
||||
'author'=>$authors[$k],
|
||||
'organization'=>$orgs[$k],
|
||||
'order'=>0
|
||||
);
|
||||
}
|
||||
//include_once("helper/view.php");
|
||||
//view::Dump($info);
|
||||
return $info;
|
||||
}
|
||||
|
||||
function view($id)
|
||||
{
|
||||
if(is_numeric($id))
|
||||
{
|
||||
$sql = "SELECT * FROM ".$this->tbl_doi." WHERE id=$id";
|
||||
}else{
|
||||
$sql = "SELECT * FROM ".$this->tbl_doi." WHERE uuid='$id'";
|
||||
}
|
||||
$rs = $this->db->query($sql);
|
||||
$row = $rs->fetch();
|
||||
return $row;
|
||||
}
|
||||
|
||||
function delete($id){
|
||||
if(!is_numeric($id))
|
||||
{
|
||||
return "参数错误";
|
||||
}
|
||||
$condition = " id=$id ";
|
||||
$sql = "DELETE FROM ".$this->tbl_doi." WHERE $condition";
|
||||
return $this->db->exec($sql);
|
||||
}
|
||||
|
||||
function _getParams(Zend_Controller_Request_Abstract $request)
|
||||
{
|
||||
$data = array(
|
||||
'doi' => trim($request->getParam('doi')),
|
||||
'uuid' => trim($request->getParam('uuid')),
|
||||
'publisher' => trim($request->getParam('publisher')),
|
||||
'url' => trim($request->getParam('url')),
|
||||
'title' => trim($request->getParam('title')),
|
||||
'info'=>$_POST['info']
|
||||
);
|
||||
return $data;
|
||||
}
|
||||
|
||||
function checkinfo($info){
|
||||
if(!is_array($info)){
|
||||
return NULL;
|
||||
}
|
||||
foreach($info as $k=>$v)
|
||||
{
|
||||
if(empty($v['author']) && empty($v['organization']) && empty($v['order']))
|
||||
{
|
||||
unset($info[$k]);
|
||||
}else{
|
||||
if(empty($v['author']))
|
||||
{
|
||||
return "请输入 $k 中的作者";
|
||||
}
|
||||
if(empty($v['organization']))
|
||||
{
|
||||
return "请输入 $k 中的单位";
|
||||
}
|
||||
if(empty($v['order']))
|
||||
{
|
||||
return "请输入 $k 中的排序";
|
||||
}
|
||||
}
|
||||
}
|
||||
return $info;
|
||||
}
|
||||
|
||||
function sksort($array,$key,$type=SORT_DESC) {
|
||||
$sortArray = array();
|
||||
|
||||
foreach($array as $v){
|
||||
foreach($v as $key=>$value){
|
||||
if(!isset($sortArray[$key])){
|
||||
$sortArray[$key] = array();
|
||||
}
|
||||
$sortArray[$key][] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
if(array_multisort($sortArray[$key],$type,$array))
|
||||
{
|
||||
return $array;
|
||||
}else{
|
||||
return $array;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,82 +1,83 @@
|
|||
<?php
|
||||
class view extends Zend_Controller_Plugin_Abstract
|
||||
{
|
||||
private $db; //传入PDO对象.
|
||||
private $product = 0; //产品环境
|
||||
|
||||
function __construct($db='')
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
static function addPaginator($data,$ctl,Zend_Controller_Request_Abstract $request)
|
||||
{
|
||||
$page = $request->getParam('page');
|
||||
|
||||
$paginator = Zend_Paginator::factory($data);
|
||||
$paginator->setCurrentPageNumber($page);
|
||||
$paginator->setItemCountPerPage(12);
|
||||
$paginator->setView($ctl);
|
||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||
$ctl->paginator = $paginator;
|
||||
}
|
||||
|
||||
static function Msg($type,$content,$url=''){
|
||||
$html = '<div class="alert '.$type.'">'."\r\n";
|
||||
$html.= '<a data-dismiss="alert" class="close">×</a>'."\r\n";
|
||||
$html.= $content."\r\n";
|
||||
$html.= '</div>'."\r\n";
|
||||
if(!empty($url))
|
||||
{
|
||||
if($url == -1){
|
||||
$html.= '<script language="javascript">setTimeout("window.history.back(-1);",3000);</script>'."\r\n";
|
||||
}else{
|
||||
$html.= '<script language="javascript">setTimeout("self.location=\''.$url.'\'",3000);</script>'."\r\n";
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
static function Error($type,$content,$url=''){
|
||||
if(empty($type))
|
||||
{
|
||||
$AlertType = "alert-error";
|
||||
}else{
|
||||
$AlertType = $type;
|
||||
}
|
||||
$html = '<div class="alert alert-block fade in '.$AlertType.'" id="Alert-error-box">'."\r\n";
|
||||
$html.= '<a class="close" data-dismiss="alert" href="#">×</a>'."\r\n";
|
||||
if(!is_array($content)) {
|
||||
$html.= '<h4 class="alert-heading">'.$content.'</h4>'."\r\n";
|
||||
}else{
|
||||
$html.= '<ul>'."\r\n";
|
||||
foreach($content as $v) {
|
||||
$html.='<li>'.$v.'</li>'."\r\n";
|
||||
}
|
||||
$html.= '</ul>'."\r\n";
|
||||
}
|
||||
$html.= '</div>'."\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 "<pre>";
|
||||
var_dump($data);
|
||||
echo "</pre>";
|
||||
if($exit)
|
||||
{
|
||||
exit();
|
||||
}
|
||||
}
|
||||
<?php
|
||||
class view extends Zend_Controller_Plugin_Abstract
|
||||
{
|
||||
private $db; //传入PDO对象.
|
||||
private $product = 0; //产品环境
|
||||
|
||||
function __construct($db='')
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
static function addPaginator($data,$ctl,Zend_Controller_Request_Abstract $request)
|
||||
{
|
||||
$page = $request->getParam('page');
|
||||
|
||||
$paginator = Zend_Paginator::factory($data);
|
||||
$paginator->setCurrentPageNumber($page);
|
||||
$paginator->setItemCountPerPage(12);
|
||||
$paginator->setView($ctl);
|
||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||
$ctl->paginator = $paginator;
|
||||
}
|
||||
|
||||
static function Msg($type,$content,$url=''){
|
||||
$html = '<div class="alert '.$type.'">'."\r\n";
|
||||
$html.= '<a data-dismiss="alert" class="close">×</a>'."\r\n";
|
||||
$html.= $content."\r\n";
|
||||
$html.= '</div>'."\r\n";
|
||||
if(!empty($url))
|
||||
{
|
||||
if($url == -1){
|
||||
$html.= '<script language="javascript">setTimeout("window.history.back(-1);",3000);</script>'."\r\n";
|
||||
}else{
|
||||
$html.= '<script language="javascript">setTimeout("self.location=\''.$url.'\'",3000);</script>'."\r\n";
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
static function Error($type,$content,$url=''){
|
||||
if(empty($type))
|
||||
{
|
||||
$AlertType = "alert-error";
|
||||
}else{
|
||||
$AlertType = $type;
|
||||
}
|
||||
$html = '<div class="alert alert-block fade in '.$AlertType.'" id="Alert-error-box">'."\r\n";
|
||||
$html.= '<a class="close" data-dismiss="alert" href="#">×</a>'."\r\n";
|
||||
if(!is_array($content)) {
|
||||
$html.= '<h4 class="alert-heading">'.$content.'</h4>'."\r\n";
|
||||
}else{
|
||||
$html.= '<ul>'."\r\n";
|
||||
foreach($content as $v) {
|
||||
$html.='<li>'.$v.'</li>'."\r\n";
|
||||
}
|
||||
$html.= '</ul>'."\r\n";
|
||||
}
|
||||
$html.= '</div>'."\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 "<pre>";
|
||||
var_dump($data);
|
||||
echo "</pre>";
|
||||
if($exit)
|
||||
{
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue