本文整理汇总了PHP中Period::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP Period::exists方法的具体用法?PHP Period::exists怎么用?PHP Period::exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Period
的用法示例。
在下文中一共展示了Period::exists方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: move_down
/**
* This method will move current period down in sorting order.
*/
public function move_down()
{
if (isset($this->id) && intval($this->id) > 0) {
$down_period = new Period();
$down_period->order_by('sorting', 'asc')->limit(1);
$down_period->where('sorting >', $this->sorting);
$down_period->get();
if ($down_period->exists()) {
$upsort = $down_period->sorting;
$down_period->sorting = $this->sorting;
if ($down_period->save()) {
$my_period = new Period();
$my_period->get_where(array('id' => $this->id));
$my_period->sorting = $upsort;
if ($my_period->save()) {
$this->sorting = $upsort;
}
}
}
}
}
示例2: inject_courses
private function inject_courses()
{
$periods = new Period();
$periods->order_by('sorting', 'asc');
$periods->get_iterated();
$data = array(NULL => '');
if ($periods->exists()) {
foreach ($periods as $period) {
$period->course->order_by_with_constant('name', 'asc')->get_iterated();
if ($period->course->exists() > 0) {
foreach ($period->course as $course) {
$data[$period->name][$course->id] = $course->name;
}
}
}
}
$this->parser->assign('courses', $data);
}
示例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());
}