本文整理汇总了PHP中MY_Model::find方法的典型用法代码示例。如果您正苦于以下问题:PHP MY_Model::find方法的具体用法?PHP MY_Model::find怎么用?PHP MY_Model::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MY_Model
的用法示例。
在下文中一共展示了MY_Model::find方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: find
public function find($criteria = array(), $n = NULL, $offset = NULL)
{
$where = $this->_get_where($criteria);
$orderby = parent::_get_orderby($criteria, 'nombre');
$order = parent::_get_order($criteria, 'ASC');
return parent::find('personas', $where, $orderby, $order, $n, $offset);
}
示例2: find
public function find($id=null)
{
$role = parent::find($id);
if (!$role) { return false; }
// Grab our permissions for the role.
$permissions = $this->permission_model->find_for_role($id);
$role->permissions = $permissions[0];
return $role;
}
示例3: login
public function login($uname, $str)
{
//取出随机数列
$login_key = $this->session->userdata('key');
$this->session->unset_userdata('key');
/*获得用户信息*/
if (parent::count(array('uname' => $uname)) == 1) {
//$q=$this->db->get_where('user',array('uname'=>$uname))->row_array();
$q = end(parent::find(array('uname' => $uname)));
//检查用户是否已经过期
if (isset($q['expire_time']) && $q['expire_time'] < time()) {
//验证待激活用户是否过期,过期则删除,并返回登陆失败
if (parent::deleteByPk($q['id'])) {
return $this->set_err(101, 'Expired User!');
} else {
return FALSE;
}
}
/*检验用户是否已经激活*/
if (!$q['active']) {
return $this->set_err(102, 'Please activate the user first');
}
/*产生服务器端的hash数据*/
$ser = sha1($q['pword'] . $login_key);
/*验证*/
if ($str == $ser) {
/*更新最后登陆时间以及登陆状态*/
/*
$this->db->where('id',$q['id']);
$this->db->update('hfi_user',array('latest_login'=>time()));
*/
parent::updateByPk(array('latest_login' => time()), $q['id']);
//更新session
$s_data = array('rsc_login' => TRUE, 'uid' => $q['id']);
$this->session->set_userdata($s_data);
//set security session
$this->session->set_userdata('security', TRUE);
$this->session->set_userdata('sec_time', time() + 60);
//设置登陆数据
$this->uid = $q['id'];
return TRUE;
/*登陆成功*/
} else {
return $this->set_err(104, 'Wrong user name and password combination.');
}
} else {
return $this->set_err(104, 'Wrong user name and password combination.');
}
}
示例4: find
public function find($id=null)
{
$this->db->join('roles', 'roles.role_id = users.role_id', 'left');
return parent::find($id);
}
示例5: find
/**
* Find posts with linked text and author's profile
*
* @param type $id
* @param type $limit
* @param type $from
* @return type
*/
public function find($id = NULL, $limit = NULL, $from = NULL)
{
$this->db->select('t.*, u.id AS user_id, u.login, u.email, u.avatar, u.banned, u.role')->join($this->users_table . ' AS u', 't.user_id = u.id', 'LEFT');
return parent::find($id, $limit, $from);
}
示例6: is_shared
/**
* Check whether the resources is shared with current user
* @param $rsc_type
* @param $rsc_id
* @return boolean whether the information is shared by the current user
*/
public function is_shared($rsc_type, $rsc_id)
{
if ($this->identity->is_researcher()) {
$uid = $this->identity->get_uid();
} else {
return FALSE;
}
if (!$this->_check_rsc($rsc_type, $rsc_id)) {
$this->err_code = 400;
$this->err_msg = "Wrong Input as Experiment Resource Identifier:[" . $rsc_type . "," . $rsc_id . "]";
return FALSE;
}
// fetch the data
$record = end(parent::find(array("rsc_type" => $rsc_type, "rsc_id" => $rsc_id)));
if (!$record) {
return FALSE;
}
//the error codes should be set up already
switch ($record["share"]) {
case "private":
return $this->is_owner($rsc_type, $rsc_id);
// since we have already checked, and the targeted user is not the owner
break;
case "limited":
// then we need to find the list
// TODO will the owner be in the list?
return in_array($uid, $record["share_list"]) || $this->is_owner($rsc_type, $rsc_id);
break;
case "protected":
return $this->identity->is_researcher();
break;
case "public":
return TRUE;
break;
default:
return FALSE;
//sorry, I just cannot
break;
}
}
示例7: getPackageByGID
public function getPackageByGID($gid)
{
return end(parent::find(['gid' => $gid]));
}