本文整理汇总了PHP中Period::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Period::where方法的具体用法?PHP Period::where怎么用?PHP Period::where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Period
的用法示例。
在下文中一共展示了Period::where方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$period_id = $this->input->post('period_id');
$filter = $this->inject_stored_filter();
$this->_initialize_student_menu();
$this->_select_student_menu_pagetag('courses');
$this->parser->add_css_file('frontend_courses.css');
$this->parser->add_js_file('courses/selection.js');
$cache_id = $this->usermanager->get_student_cache_id('period_' . ($period_id ? $period_id : @$filter['period_id']));
if (!$this->_is_cache_enabled() || !$this->parser->isCached($this->parser->find_view('frontend/courses/index.tpl'), $cache_id)) {
$periods = new Period();
if (intval($period_id) == 0) {
if (isset($filter['period_id'])) {
$periods->where('id', $filter['period_id']);
} else {
$periods->limit(1);
}
} else {
$periods->where('id', $period_id);
}
$periods->order_by('sorting', 'asc')->get();
$filter['period_id'] = $periods->id;
$this->store_filter($filter);
$this->inject_period_options();
$this->parser->assign(array('periods' => $periods));
}
$this->parser->parse('frontend/courses/index.tpl', array(), FALSE, $this->_is_cache_enabled(), $cache_id);
}
示例2: delete
/**
* Delete this period or related object.
* If no parameters are set, this method deletes current period and re-sort all other periods.
* @param DataMapper|string $object related object to delete from relation.
* @param string $related_field relation internal name.
*/
public function delete($object = '', $related_field = '')
{
if (empty($object) && !is_array($object) && !empty($this->id)) {
$lower_periods = new Period();
$lower_periods->order_by('sorting', 'asc');
$lower_periods->where('sorting > ', $this->sorting);
$lower_periods->get_iterated();
$ids = array();
foreach ($lower_periods as $lower_period) {
$ids[] = $lower_period->id;
}
if (count($ids) > 0) {
$this->db->set('sorting', 'sorting-1', FALSE);
$this->db->where_in('id', $ids);
$this->db->update('periods');
}
}
parent::delete($object, $related_field);
}
示例3: _is_unique_name_not_in
public function _is_unique_name_not_in($str, $id)
{
$period = new Period();
$period->where('name', $str);
$period->where('id !=', intval($id));
$period->get();
return (bool) (!$period->exists());
}