function checkAlerttype($type)
 {
     if ($type) {
         if (is_array($type)) {
             if (count($type) > 0) {
                 $firsttype = false;
                 foreach ($type as $typei => $typeinfo) {
                     $firsttype = $typeinfo;
                     break;
                 }
                 return checkAlerttype($firsttype);
             }
         } else {
             switch (strtolower(trim($type))) {
                 case "danger":
                     return "danger";
                     break;
                 case "warning":
                     return "warning";
                     break;
                 case "info":
                     return "info";
                     break;
                 case "success":
                     return "success";
                     break;
                 default:
                     return "info";
                     break;
             }
         }
     }
     return "info";
 }
Exemple #2
0
 function get_simple_alert_message($ind = false, $array_alerts = false, $closable = false)
 {
     $ret = false;
     $newmessage = $this->get_message($ind) ? $this->view_message($ind) : false;
     $newmessagetype = $this->get_message($ind) ? $this->get_message_type($ind) : false;
     $newmessagetitle = $this->get_message($ind) ? $this->get_message_title($ind) : false;
     if ($newmessage) {
         if (is_array($newmessage)) {
             if (count($newmessage) > 0) {
                 if ($array_alerts) {
                     $ret = array();
                     $messagetype = $newmessagetype ? is_array($newmessagetype) ? count($newmessagetype) > 0 ? $newmessagetype : array("info") : array($newmessagetype) : array("info");
                     $messagetitle = $newmessagetitle ? is_array($newmessagetitle) ? count($newmessagetitle) > 0 ? $newmessagetitle : array("Alert!") : array($newmessagetitle) : array("Alert!");
                     foreach ($newmessage as $ni => $nm) {
                         $messageti = isset($messagetitle[$ni]) ? $messagetitle[$ni] : (isset($messagetitle[0]) ? $messagetitle[0] : "Alert!");
                         $messagety = isset($messagetype[$ni]) ? checkAlerttype($messagetype[$ni]) : (isset($messagetype[0]) ? checkAlerttype($messagetype[0]) : "info!");
                         $ret[] = $this->makeSimplelertmessage($messageti, $messagety, $nm, $closable);
                     }
                 } else {
                     $messagetype = $newmessagetype ? is_array($newmessagetype) ? count($newmessagetype) > 0 ? checkAlerttype($newmessagetype[0]) : "info" : checkAlerttype($newmessagetype) : "info";
                     $messagetitle = $newmessagetitle ? is_array($newmessagetitle) ? count($newmessagetitle) > 0 ? $newmessagetitle[0] : "Alert!" : $newmessagetitle : "Alert!";
                     $ret = $this->makeSimplelertmessage($messagetitle, $messagetype, $newmessage, $closable);
                 }
             }
         } else {
             $messagetype = $newmessagetype ? is_array($newmessagetype) ? "info" : checkAlerttype($newmessagetype) : "info";
             $messagetitle = $newmessagetitle ? is_array($newmessagetitle) ? "Alet!" : $newmessagetitle : "Alert!";
             $ret = $this->makeSimplelertmessage($messagetitle, $messagetype, $newmessage, $closable);
         }
     }
     return $ret;
 }