本文整理汇总了PHP中MY_Model::get_by_slug方法的典型用法代码示例。如果您正苦于以下问题:PHP MY_Model::get_by_slug方法的具体用法?PHP MY_Model::get_by_slug怎么用?PHP MY_Model::get_by_slug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MY_Model
的用法示例。
在下文中一共展示了MY_Model::get_by_slug方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_by_slug
/**
* Get a single lesson row by its slug
* @param String $lesson(Represents lesson slug)
* @return Object
*/
public function get_by_slug($lesson)
{
$lesson_array = array('lesson_slug' => $lesson);
$result = parent::get_by_slug($lesson_array, TRuE);
return $result;
}
示例2: user_notification
/**
* Description: Updating existing Notification objects depending on the type of notification for ordinary users
* @return Array of Objects
*/
public function user_notification($id)
{
$lesson_array = array('recive_id' => $id, 'flag' => 1);
$result = parent::get_by_slug($lesson_array, false);
$i = 0;
foreach ($result as $notification) {
switch ($notification->type) {
case 1:
$notification->type_name = $this->lang->line("note_type_1");
break;
case 2:
$notification->type_name = $this->lang->line("note_type_2");
break;
case 3:
$notification->type_name = $this->lang->line("note_type_3");
break;
case 4:
$notification->type_name = $this->lang->line("note_type_4");
break;
default:
$notification->type_name = $this->lang->line("note_type_default");
break;
}
$temp = $this->notification_details($notification->note_id, $notification->type);
$notification->username = $temp[0]->username;
$notification->first_name = $temp[0]->first_name;
$notification->last_name = $temp[0]->last_name;
if ($notification->type == 1) {
$notification->lesson_name = $temp[0]->lesson_name;
}
if ($notification->type == 2) {
$notification->course_name = $temp[0]->title;
}
if ($notification->type == 3) {
$notification->first_name = $temp[0]->first_name;
$notification->last_name = $temp[0]->last_name;
}
$new_result[$i] = $notification;
$i++;
}
return $result;
}