本文整理汇总了PHP中MY_Model::get_by方法的典型用法代码示例。如果您正苦于以下问题:PHP MY_Model::get_by方法的具体用法?PHP MY_Model::get_by怎么用?PHP MY_Model::get_by使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MY_Model
的用法示例。
在下文中一共展示了MY_Model::get_by方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_by
/**
* Override parent
*/
public function get_by($where, $joins = array())
{
$this->set_table_alias('u');
$this->db->select('u.id, u.email, u.password, u.first_name, u.last_name, u.active, ug.name AS group');
$joins[] = array('user_groups AS ug', 'u.group_id = ug.id');
return parent::get_by($where, $joins);
}
示例2: get_provinsi_id
public function get_provinsi_id($id)
{
$data = array();
$this->db->order_by('lokasi_ID', 'esc');
$data = parent::get_by(array('lokasi_kabupatenkota' => 0, 'lokasi_kecamatan' => 0, 'lokasi_kelurahan' => 0, 'lokasi_propinsi' => $id));
return $data;
}
示例3: get_with_join
public function get_with_join($id = NULL, $single = FALSE)
{
$this->db->select("packages.*, l.title as package_location, c.title as package_category,s.title as package_scheme,h.title as package_hotel,t.title as package_transport,m.file_name as media_image");
$this->db->join("locations as l", "packages.location_id=l.id", 'left');
$this->db->join("category as c", "packages.category_id=c.id", 'left');
$this->db->join("schemes as s", "packages.scheme_id=s.id", 'left');
$this->db->join("hotels as h", "packages.hotel_id=h.id", 'left');
$this->db->join("transports as t", "packages.transport_id=t.id", 'left');
$this->db->join("medias as m", "packages.image=m.id", 'left');
if ($id) {
$where = array('packages.id' => $id);
return parent::get_by($where, $single);
} else {
return parent::get();
}
}
示例4: run
public function run($params = array())
{
//dump($params);
$this->db->select("packages.*, l.title as package_location,\n c.title as package_category,s.title as package_scheme,\n h.title as package_hotel,t.title as package_transport,\n m.file_name as media_image");
$this->db->join("locations as l", "packages.location_id=l.id", 'left');
$this->db->join("category as c", "packages.category_id=c.id", 'left');
$this->db->join("schemes as s", "packages.scheme_id=s.id", 'left');
$this->db->join("hotels as h", "packages.hotel_id=h.id", 'left');
$this->db->join("transports as t", "packages.transport_id=h.id", 'left');
$this->db->join("medias as m", "packages.image=m.id", 'left');
if (isset($params['category_id'])) {
$where = array('packages.category_id' => $params['category_id']);
$ARRs = parent::get_by($where);
} else {
$ARRs = parent::get();
}
//isset($params['category_id']) ? $where = array('packages.category_id'=>$params['category_id']) : NULL;
$str = '';
//dump($ARRs);
foreach ($ARRs as $package) {
$str .= '<div class="destination-places-grids">';
$str .= '<div class="destination-places-grid last-d-grid" onclick="location.href=\'/package/' . $package->id . '\';">';
$str .= '<div class="dest-place-pic main_box user_style4" data-hipop="two-horizontal">';
$str .= '<img src="' . base_url('wc-upload/gallery') . '/' . $package->media_image . '" title="' . $package->title . '" width="480" height="180" />';
$str .= '<a href="#" class="popup"> </a>';
$str .= '<a href="#" class="popup2"> </a>';
$str .= '</div>';
$str .= '<div class="dest-place-opt">';
$str .= '<ul class="dest-place-opt-fea">';
$str .= '<li><a class="hot" href="#"><span> </span>' . $package->package_hotel . '</a></li>';
$str .= '<li><a class="plain" href="#"><span> </span>' . $package->package_transport . '</a></li>';
$str .= '<li><a class="Breakfast" href="#"><span> </span>' . $package->package_scheme . '</a></li>';
$str .= '<div class="clear"></div>';
$str .= '</ul>';
$str .= '<ul class="dest-place-opt-cast">';
$str .= '<li><a class="d-place" href="#">' . $package->package_location . '</a></li>';
$str .= '<li><a class="d-price" href="#">Starting Form ' . $package->price . '</a></li>';
$str .= '<div class="clear"></div>';
$str .= '</ul>';
$str .= '</div>';
$str .= '</div>';
}
$str .= '<div class="clear"></div>';
$str .= '</div>';
return $str;
}
示例5: run
public function run($params = array())
{
//dump($params);
$this->db->select("locations.*, c.title as package_category,m.file_name as media_image");
$this->db->join("category as c", "locations.category_id=c.id", 'left');
$this->db->join("medias as m", "locations.image=m.id", 'left');
if (isset($params['category_id'])) {
$where = array('locations.category_id' => $params['category_id']);
$ARRs = parent::get_by($where);
} else {
$ARRs = parent::get();
}
//isset($params['category_id']) ? $where = array('packages.category_id'=>$params['category_id']) : NULL;
$str = '';
//dump($ARRs);
foreach ($ARRs as $package) {
$str .= '<div class="destination-places-grids">';
$str .= '<div class="destination-places-grid last-d-grid" onclick="location.href=\'/location/' . $package->id . '\';">';
$str .= '<div class="dest-place-pic main_box user_style4" data-hipop="two-horizontal">';
$str .= '<img src="' . base_url('wc-upload/gallery') . '/' . $package->media_image . '" title="' . $package->title . '" width="480" height="180" />';
$str .= '<a href="#" class="popup"> </a>';
$str .= '<a href="#" class="popup2"> </a>';
$str .= '</div>';
$str .= '<div class="dest-place-opt">';
$str .= '<ul class="dest-place-opt-cast">';
$str .= '<li><a class="d-place" href="#">' . $package->package_category . ' : </a></li>';
$str .= '<li><a class="d-place" href="#"> : ' . $package->title . '</a></li>';
$str .= '<div class="clear"></div>';
$str .= '</ul>';
$str .= '</div>';
$str .= '</div>';
}
$str .= '<div class="clear"></div>';
$str .= '</div>';
return $str;
}
示例6: get_archive_link
public function get_archive_link()
{
$page = parent::get_by(array('template' => 'news_archive'), TRUE);
return isset($page->slug) ? $page->slug : '';
}
示例7: get_topic_forum
public function get_topic_forum($topicID = 0)
{
$this->_table = 'forum_topics';
return parent::get_by('id', $topicID);
}
示例8: get_id_from_slug
public function get_id_from_slug($slug)
{
$data = parent::get_by('slug', $slug);
return $data->id;
}
示例9: get_by
/**
* Get rows where the key matches value
*
* @param string $key Which column to use on WHERE
* @param string $value Value for $key to match
* @param string $where_extra Extra clauses for WHERE
* @return array DB results. If LIMIT is 1, row_array(); otherwise result_array()
*/
public function get_by($key = '', $value = '', $where_extra = '')
{
$where_extra .= $this->sch_sql();
return parent::get_by($key, $value, $where_extra);
}