本文整理汇总了PHP中Application_Model_GlobalClass::getYesNoOption方法的典型用法代码示例。如果您正苦于以下问题:PHP Application_Model_GlobalClass::getYesNoOption方法的具体用法?PHP Application_Model_GlobalClass::getYesNoOption怎么用?PHP Application_Model_GlobalClass::getYesNoOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application_Model_GlobalClass
的用法示例。
在下文中一共展示了Application_Model_GlobalClass::getYesNoOption方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: viewUserAccessAction
public function viewUserAccessAction()
{
/* Initialize action controller here */
if ($this->getRequest()->getParam('id')) {
$id = $this->getRequest()->getParam('id');
$db = new RsvAcl_Model_DbTable_DbUserType();
$userAccessQuery = "SELECT user_type_id, user_type, status from rms_acl_user_type where user_type_id=" . $id;
$rows = $db->getUserTypeInfo($userAccessQuery);
$this->view->rs = $rows;
//Add filter search
$gc = new Application_Model_GlobalClass();
// For list all module
$sql = "SELECT DISTINCT acl.`module` FROM `rms_acl_acl` AS acl";
$this->view->optoin_mod = $gc->getOptonsHtml($sql, "module", "module");
// For list all controller
$sql = "SELECT DISTINCT acl.`controller` FROM `rms_acl_acl` AS acl WHERE acl.`status` = 1";
$this->view->optoin_con = $gc->getOptonsHtml($sql, "controller", "controller");
// For List all action
$sql = "SELECT DISTINCT acl.`action` FROM `rms_acl_acl` AS acl WHERE acl.`status` = 1";
$this->view->optoin_act = $gc->getOptonsHtml($sql, "action", "action");
//For Status enable or disable
$this->view->optoin_status = $gc->getYesNoOption();
$where = " ";
$status = null;
if ($this->getRequest()->isPost()) {
$post = $this->getRequest()->getPost();
if (!empty($post['fmod'])) {
$where .= " AND acl.`module` = '" . $post['fmod'] . "' ";
}
if (!empty($post['fcon'])) {
$where .= " AND acl.`controller` = '" . $post['fcon'] . "' ";
}
if (!empty($post['fact'])) {
$where .= " AND acl.`action` = '" . $post['fact'] . "' ";
}
if (!empty($post['fstatus'])) {
$status = $post['fstatus'] === "Yes" ? 1 : 0;
//$where .= " AND acl.`status` = " . $st ;
}
$this->view->datafiter = $post;
//echo $where; exit;
}
//Sophen add here
//to assign project list in view
$db_acl = new Application_Model_DbTable_DbGlobal();
$sqlNotParentId = "SELECT user_type_id FROM `rms_acl_user_type` WHERE `parent_id` =" . $id;
$notParentId = $db_acl->getGlobalDb($sqlNotParentId);
$usernotparentid = $notParentId[0]['user_type_id'];
if ($id == 1) {
//Display all for admin id = 1
//Do not change admin id = 1 in database
//Otherwise, it error
$sql = "select acl.acl_id,CONCAT(acl.module,'/', acl.controller,'/', acl.action) AS user_access\n\t\t\t\t\t\tfrom rms_acl_acl as acl \n\t\t\t\t\t\tWHERE 1 " . $where;
} else {
//Display all of his/her parent access
$sql = "SELECT acl.acl_id, CONCAT(acl.module,'/', acl.controller,'/', acl.action) AS user_access, acl.status \n\t\t\t\t\t\tFROM rms_acl_user_access AS ua \n\t\t\t\t\t\tINNER JOIN rms_acl_user_type AS ut ON (ua.user_type_id = ut.parent_id)\n\t\t\t\t\t\tINNER JOIN rms_acl_acl AS acl ON (acl.acl_id = ua.acl_id) WHERE ut.user_type_id =" . $id . $where;
}
//echo $sql; exit;
$acl = $db_acl->getGlobalDb($sql);
$acl = is_null($acl) ? array() : $acl;
//print_r($acl);
$this->view->acl = $acl;
if (!$usernotparentid) {
///Display only of his/her parent access and not have user_type_id of user access in user type parent id
//ua.user_type_id != ut.parent_id
$sql_acl = "SELECT acl.acl_id, CONCAT(acl.module,'/', acl.controller,'/', acl.action) AS user_access, acl.status \n\t\t\t\t\t\t\tFROM rms_acl_user_access AS ua \n\t\t\t\t\t\t\tINNER JOIN rms_acl_user_type AS ut ON (ua.user_type_id = ut.user_type_id)\n\t\t\t\t\t\t\tINNER JOIN rms_acl_acl AS acl ON (acl.acl_id = ua.acl_id) WHERE ua.user_type_id =" . $id . $where;
} else {
//Display only he / she access in rms_acl_user_access
$sql_acl = "SELECT acl.acl_id, CONCAT(acl.module,'/', acl.controller,'/', acl.action) AS user_access, acl.status \n\t\t\t\t\t\t\tFROM rms_acl_user_access AS ua \n\t\t\t\t\t\t\tINNER JOIN rms_acl_user_type AS ut ON (ua.user_type_id = ut.parent_id)\n\t\t\t\t\t\t\tINNER JOIN rms_acl_acl AS acl ON (acl.acl_id = ua.acl_id) WHERE ua.user_type_id =" . $id . $where;
}
$acl_name = $db_acl->getGlobalDb($sql_acl);
$acl_name = is_null($acl_name) ? array() : $acl_name;
// $imgnone='<img src="'.BASE_URL.'/images/icon/none.png"/>';
// $imgtick='<img src="'.BASE_URL.'/images/icon/tick.png"/>';
$rows = array();
$num = 1;
foreach ($acl as $com) {
$img = '<img src="' . BASE_URL . '/images/icon/none.png" id="img_' . $com['acl_id'] . '" onclick="changeStatus(' . $com['acl_id'] . ',' . $id . ');" class="pointer"/>';
$tmp_status = 0;
foreach ($acl_name as $read) {
if ($read['acl_id'] == $com['acl_id']) {
$img = '<img src="' . BASE_URL . '/images/icon/tick.png" id="img_' . $com['acl_id'] . '" onclick="changeStatus(' . $com['acl_id'] . ', ' . $id . ');" class="pointer"/>';
$tmp_status = 1;
break;
}
}
if (!empty($status) || $status === 0) {
if ($tmp_status !== $status) {
continue;
}
}
$rows[] = array('num' => $num++, 'acl_id' => $com['acl_id'], "user_access" => $com['user_access'], 'status' => $tmp_status);
}
// $list=new Application_Form_Frmlist();
// $tr = Application_Form_FrmLanguages::getCurrentlanguage();
// $columns=array($tr->translate('URL'), $tr->translate('STATUS'));
// $this->view->acl_name = $list->getCheckList('radio', $columns, $rows);
$db_tran = new Application_Model_DbTable_DbGlobal();
//create sesesion
$session_transfer = new Zend_Session_Namespace('search_user-access-acl');
//.........这里部分代码省略.........
示例2: addAction
public function addAction()
{
/* Initialize action controller here */
if ($this->getRequest()->getParam('id')) {
$id = $this->getRequest()->getParam('id');
$db = new RsvAcl_Model_DbTable_DbUserType();
$userAccessQuery = "SELECT user_type_id, user_type, status from rms_acl_user_type where user_type_id=" . $id;
$rows = $db->getUserTypeInfo($userAccessQuery);
$this->view->rs = $rows;
//Add filter search
$gc = new Application_Model_GlobalClass();
// For list all module
$sql = "SELECT DISTINCT acl.`module` FROM `rms_acl_acl` AS acl";
$this->view->optoin_mod = $gc->getOptonsHtml($sql, "module", "module");
// For list all controller
$sql = "SELECT DISTINCT acl.`controller` FROM `rms_acl_acl` AS acl WHERE acl.`status` = 1";
$this->view->optoin_con = $gc->getOptonsHtml($sql, "controller", "controller");
// For List all action
$sql = "SELECT DISTINCT acl.`action` FROM `rms_acl_acl` AS acl WHERE acl.`status` = 1";
$this->view->optoin_act = $gc->getOptonsHtml($sql, "action", "action");
//For Status enable or disable
$this->view->optoin_status = $gc->getYesNoOption();
$where = " ";
$status = null;
if ($this->getRequest()->isPost()) {
$post = $this->getRequest()->getPost();
if (!empty($post['fmod'])) {
$where .= " AND acl.`module` = '" . $post['fmod'] . "' ";
}
if (!empty($post['fcon'])) {
$where .= " AND acl.`controller` = '" . $post['fcon'] . "' ";
}
if (!empty($post['fact'])) {
$where .= " AND acl.`action` = '" . $post['fact'] . "' ";
}
if (!empty($post['fstatus'])) {
$status = $post['fstatus'] === "Yes" ? 1 : 0;
//$where .= " AND acl.`status` = " . $st ;
}
//echo $where; exit;
} else {
$post = array('fmod' => '', 'fcon' => '', 'fact' => '', 'fstatus' => '');
}
$this->view->data = $post;
//Sophen add here
//to assign project list in view
$db_acl = new Application_Model_DbTable_DbGlobal();
$sqlNotParentId = "SELECT user_type_id FROM `rms_acl_user_type` WHERE `parent_id` =" . $id;
$notParentId = $db_acl->getGlobalDb($sqlNotParentId);
$usernotparentid = $notParentId[0]['user_type_id'];
if ($id == 1) {
//Display all for admin id = 1
//Do not change admin id = 1 in database
//Otherwise, it error
$sql = "select acl.acl_id,acl.label,CONCAT(acl.module,'/', acl.controller,'/', acl.action) AS user_access\r\n \t\t\tfrom rms_acl_acl as acl\r\n \t\t\tWHERE 1 " . $where;
} else {
//Display all of his/her parent access
$sql = "SELECT acl.acl_id,acl.label, CONCAT(acl.module,'/', acl.controller,'/', acl.action) AS user_access, acl.status\r\n \t\t\tFROM rms_acl_user_access AS ua\r\n \t\t\tINNER JOIN rms_acl_user_type AS ut ON (ua.user_type_id = ut.parent_id)\r\n \t\t\tINNER JOIN rms_acl_acl AS acl ON (acl.acl_id = ua.acl_id) WHERE ut.user_type_id =" . $id . $where;
}
//echo $sql; exit;
$acl = $db_acl->getGlobalDb($sql);
$acl = is_null($acl) ? array() : $acl;
//print_r($acl);
$this->view->acl = $acl;
if (!$usernotparentid) {
///Display only of his/her parent access and not have user_type_id of user access in user type parent id
//ua.user_type_id != ut.parent_id
$sql_acl = "SELECT acl.acl_id,acl.label, CONCAT(acl.module,'/', acl.controller,'/', acl.action) AS user_access, acl.status\r\n \t\t\tFROM rms_acl_user_access AS ua\r\n \t\t\tINNER JOIN rms_acl_user_type AS ut ON (ua.user_type_id = ut.user_type_id)\r\n \t\t\tINNER JOIN rms_acl_acl AS acl ON (acl.acl_id = ua.acl_id) WHERE ua.user_type_id =" . $id . $where;
} else {
//Display only he / she access in rsv_acl_user_access
$sql_acl = "SELECT acl.acl_id,acl.label, CONCAT(acl.module,'/', acl.controller,'/', acl.action) AS user_access, acl.status\r\n \t\t\tFROM rms_acl_user_access AS ua\r\n \t\t\tINNER JOIN rms_acl_user_type AS ut ON (ua.user_type_id = ut.parent_id)\r\n \t\t\tINNER JOIN rms_acl_acl AS acl ON (acl.acl_id = ua.acl_id) WHERE ua.user_type_id =" . $id . $where;
}
$acl_name = $db_acl->getGlobalDb($sql_acl);
$acl_name = is_null($acl_name) ? array() : $acl_name;
$imgnone = '<img src="' . BASE_URL . '/images/icon/none.png"/>';
$imgtick = '<img src="' . BASE_URL . '/images/icon/tick.png"/>';
$rows = array();
foreach ($acl as $com) {
$img = '<img src="' . BASE_URL . '/images/icon/none.png" id="img_' . $com['acl_id'] . '" onclick="changeStatus(' . $com['acl_id'] . ',' . $id . ');" class="pointer"/>';
$tmp_status = 0;
foreach ($acl_name as $read) {
if ($read['acl_id'] == $com['acl_id']) {
$img = '<img src="' . BASE_URL . '/images/icon/tick.png" id="img_' . $com['acl_id'] . '" onclick="changeStatus(' . $com['acl_id'] . ', ' . $id . ');" class="pointer"/>';
$tmp_status = 1;
break;
}
}
if (!empty($status) || $status === 0) {
if ($tmp_status !== $status) {
continue;
}
}
$rows[] = array($com['acl_id'], $com['label'], $com['user_access'], $img);
}
// $list=new Application_Form_Frmlist();
$list = new Application_Form_Frmtable();
$tr = Application_Form_FrmLanguages::getCurrentlanguage();
$columns = array("Label", $tr->translate('URL'), $tr->translate('STATUS'));
$this->view->list = $list->getCheckList('radio', $columns, $rows);
//$this->view->acl_name=$acl_name;
//.........这里部分代码省略.........