芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/thefirstcookout.com/support/application/libraries/AppNotification.php
id=$id; $obj->title=$title; $obj->addTime=$time; $obj->icon=$icon; $obj->text=$text; $obj->href=$href; $obj->message_from=$sender_title; $obj->message_from_img=$sender_img; $obj->isViewed=$isViewed; $obj->isPopup=$is_popup_link; self::$notifications[]=$obj; } public static function addMessage($id,$title,$time,$text,$href,$msg_user_title,$msg_user_img,$is_popup_link=false,$isViewed=false){ $obj=new AMessage(); $obj->id=$id; $obj->title=$title; $obj->addTime=$time; $obj->message_from=$msg_user_title; $obj->message_from_img=$msg_user_img; $obj->text=$text; $obj->href=$href; $obj->isViewed=$isViewed; $obj->isPopup=$is_popup_link; self::$messages[]=$obj; } public static function addTaskold($id,$title,$time,$totalTask,$completed_task,$href,$is_popup_link=false,$isViewed=false){ $obj=new ATask(); $obj->id=$id; $obj->title=$title; $obj->addTime=$time; $obj->totalTask=$totalTask; $obj->completedTask=$completed_task; $obj->href=$href; $obj->isViewed=$isViewed; $obj->isPopup=$is_popup_link; self::$tasks[]=$obj; } public static function addTask($id,$title,$time,$text,$href,$is_popup_link=false,$isViewed=false,$icon="fa fa-bell-o"){ $obj=new ANotificaiton(); $obj->id=$id; $obj->title=$title; $obj->addTime=$time; $obj->icon=$icon; $obj->text=$text; $obj->href=$href; $obj->isViewed=$isViewed; $obj->isPopup=$is_popup_link; self::$tasks[]=$obj; } public static function totalNotifications(){ return count(self::$notifications); } public static function totalMessages(){ return count(self::$messages); } public static function totalTasks(){ return count(self::$tasks); } /** * @return multitype:ANotificaiton */ public static function getAllNotifications(){ return self::$notifications; } /** * @return multitype:AMessage */ public static function getAllMessages(){ return self::$messages; } /** * @return multitype:ATask */ public static function getAllTasks(){ return self::$tasks; } public static function getAllTicketUnknownNotification(){ return self::$unread_ticket_noti; } public static function CheckTicketNotification($ticket_id) { if(!empty(self::$unread_ticket_noti[$ticket_id]) && is_array(self::$unread_ticket_noti[$ticket_id])){ foreach (self::$unread_ticket_noti[$ticket_id] as $noti_id){ Mapp_notificaiton::ViewedByID($noti_id); } } } public static function SetData() { $adminData = GetAdminData(); if ($adminData) { $noti = new Mapp_notificaiton(); $noti->user_id($adminData->id); $noti->status("in ('A','V')",true); $notifications = $noti->SelectAll('', 'status'); if (!empty($notifications)) { foreach ($notifications as $ndata) { if($ndata->status=="A" && !empty($ndata->extra_param)){ $extraParam=json_decode(base64_decode($ndata->extra_param)); if(!empty($extraParam->id)){ if(!isset(self::$unread_ticket_noti[$extraParam->id])){ self::$unread_ticket_noti[$extraParam->id]=[]; } self::$unread_ticket_noti[$extraParam->id][]=$ndata->id; } } self::addNotification($ndata->id, $ndata->title, $ndata->entry_time, $ndata->msg, "", "", $ndata->entry_link, $ndata->is_popup_link == "Y", $ndata->status == "V"); } } } } public static function getNotificationHTML(){ $adminData = GetAdminData(); if (!$adminData) { return ""; } $noti = new Mapp_notificaiton(); $noti->user_id($adminData->id); $noti->entry_type("N"); $noti->status('A'); $count=$noti->CountALL(); $noti->status("in ('A','V')",true); $notifications = $noti->SelectAll('', 'id',"DESC","10"); ob_start(); ?>
0){?>
entry_link=!empty($ndata->entry_link)?admin_url('notification/show/'.$ndata->id):"javascript:void(0);"; ?>
">
is_popup_link=="Y"){?> data-effect="mfp-move-from-top" class="popupformWR app-noti-click" class="app-noti-click" href="entry_link;?>">
title.(($ndata->n_counter>1)?"(".$ndata->n_counter.")":"");?>
entry_time);?>
msg;?>
user_id($adminData->id); $noti->entry_type("N"); $noti->status('A'); $count=$noti->CountALL(); $noti->status("in ('A','V')",true); $notifications = $noti->SelectAll('', 'id',"DESC","10"); ob_start(); ?>
0){?>
entry_link=!empty($ndata->entry_link)?admin_url('notification/show/'.$ndata->id):"javascript:void(0);"; ?>
">
is_popup_link=="Y"){?> data-effect="mfp-move-from-top" class="popupformWR app-noti-click" class="app-noti-click" href="entry_link;?>" >
title.(($ndata->n_counter>1)?"(".$ndata->n_counter.")":"");?>
entry_time);?>
msg;?>
user_id($adminData->id); $noti->entry_type("M"); $noti->status('A'); $count=$noti->CountALL(); $noti->status("in ('A','V')",true); $notifications = $noti->SelectAll('', 'id',"DESC","10"); ob_start(); ?>
0){?>
entry_link=!empty($ndata->entry_link)?admin_url('notification/show/'.$ndata->id):"javascript:void(0);"; ?>
is_popup_link=="Y"){?> data-effect="mfp-move-from-top" class="popupformWR app-noti-click" class="app-noti-click" href="entry_link;?>" >
title.(($ndata->n_counter>1)?"(".$ndata->n_counter.")":"");?>
entry_time);?>
msg;?>
user_id($adminData->id); $noti->entry_type("M"); $noti->status('A'); $count=$noti->CountALL(); $noti->status("in ('A','V')",true); $notifications = $noti->SelectAll('', 'id',"DESC","10"); ob_start(); ?>
0){?>
entry_link=!empty($ndata->entry_link)?admin_url('notification/show/'.$ndata->id):"javascript:void(0);"; ?>
">
is_popup_link=="Y"){?> data-effect="mfp-move-from-top" class="popupformWR app-noti-click" class="app-noti-click" href="entry_link;?>">
title.(($ndata->n_counter>1)?"(".$ndata->n_counter.")":"");?>
entry_time);?>
msg;?>
0){?>
0){?>
You have tasks
title;?>
getCompletePercentage();?>%
getCompletePercentage();?>% Complete
You have no task right now
addTime); $time2obj = new DateTime(); $time2obj->setTimestamp(time()); $dif=$time1obj->diff($time2obj); $returnstr="0 second"; if($dif->y>0){ $returnstr="{$dif->y} year".($dif->y>1?"s":""); }elseif ($dif->m>0){ $returnstr="{$dif->m} month".($dif->m>1?"s":""); }elseif ($dif->d>0){ $returnstr="{$dif->d} day".($dif->d>1?"s":""); }elseif ($dif->h>0){ $returnstr="{$dif->h} hour".($dif->h>1?"s":""); }elseif ($dif->i>0){ $returnstr="{$dif->i} minute".($dif->i>1?"s":""); }elseif ($dif->s>0){ $returnstr="{$dif->s} second".($dif->s>1?"s":""); } return $returnstr." ago"; } } class AMessage extends ANotificaiton{ public $message_from; public $message_from_img; } class ATask extends ANotificaiton{ public $totalTask; public $completedTask; public $color; public function getCompletePercentage(){ $returnp=0; if($this->totalTask>0){ $returnp=($this->completedTask/$this->totalTask)*100; $returnp=floor($returnp); }else{ $returnp=100; } return $returnp>100?100:$returnp; } }