本文整理汇总了PHP中Func::findAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Func::findAll方法的具体用法?PHP Func::findAll怎么用?PHP Func::findAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Func
的用法示例。
在下文中一共展示了Func::findAll方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionList
public function actionList()
{
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
$list = array();
$criteria = new CDbCriteria(array('order' => 'id ASC'));
$funcs = new Func();
$count = $funcs->count($criteria);
$pager = new CPagination($count);
$pager->pageSize = Yii::app()->params['postsPerPage'];
$pager->setCurrentPage($page - 1);
$pager->applyLimit($criteria);
$list = $funcs->findAll($criteria);
$this->render('list', array('r' => Yii::app()->request->baseUrl . '/', 'pages' => $pager, 'list' => $list));
}
示例2: actionEdit
public function actionEdit()
{
$msgRole = "";
$request = Yii::app()->getRequest();
$id = trim($request->getParam("id"));
if (!empty($_POST)) {
$name = trim($request->getPost('name'));
$r_isall = trim($request->getPost('resource'));
if ($name == "") {
$msgRole = "角色名称选项不能留空";
} else {
if (strlen($name) > 64) {
$msgRole = "输入不能大于64个字符";
}
}
if ($r_isall == "0") {
$str_res = $r_isall;
} else {
$res_detail = $request->getPost('role');
$str_res = implode(",", $res_detail);
}
if ($msgRole == "") {
$uid = rand(1, 999999 * microtime());
$role = array('rid' => $uid, 'name' => $name);
$permission = array('rid' => $uid, 'perm' => $str_res);
try {
$perm = new Permission();
$perm = $perm->find('rid=:rid', array(':rid' => $id));
$perm->_attributes = $permission;
$perm->setIsNewRecord(false);
$perm->update();
$rl = new Role();
$rl = $rl->find('rid=:rid', array(':rid' => $id));
$rl->_attributes = $role;
$rl->setIsNewRecord(false);
$rl->update();
$this->redirect(array('list'));
} catch (CDbException $re) {
throw CDbException($re);
}
}
}
try {
$rs = new Role();
$rsInfo = $rs->find('rid=:rid', array(':rid' => $id));
$func = new Func();
$res = $func->findAll();
$perm = new Permission();
$permInfo = $perm->find('rid=:rid', array(':rid' => $id));
} catch (CDbException $e) {
throw CDbException($e);
}
$this->render('edit', array('r' => Yii::app()->request->baseUrl . '/', 'rsInfo' => $rsInfo, 'res' => $res, 'permInfo' => $permInfo, 'msgRole' => $msgRole));
}