I got a method to be use frequently. Here is my code:
function dashboard_notification($arr_notification_data='')
{
if($arr_notification_data == ''):
return false;
endif;
$this->db->insert('message_notification', array(
'dst_group' => MESSAGE_DESTINATION_STUDENT_SPECIFIC,
'dst_user_type' => USER_TYPE_STUDENT,
'dst_user_id' => $student_id,
'alert_type' => MESSAGE_ALERT_TYPE_EXCLAIMATION,
'dt_expiry' => date('Y-m-d H:i:s', time() + 14*24*60*60),
'src_user_type' => USER_TYPE_ADMIN,
'src_user_id' => $this->curuser['admin_id'] ? $this->curuser['admin_id'] : 0,
'msg_subject' => 'New school name',
'msg_content' => 'Your school name was rejected, please update your school name again',
'link_label' => 'Update now',
'link_url' => 'http://url/profile/update/school/',
'dt_added' => timenow(),
'dt_updated' => timenow()
));
}
Is there any better ways to make this function as a helper? Since this function got to much variables...
Not much you could change you know, one thing I would though, I wouldn't hardcode the values inside of the function
Then I would pass that data as an argument to the function this way its reusable: