/** * 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; }
/** * 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; }