function id($args)
 {
     list($id, $name) = $args;
     $cm = new CalendarModel();
     $ct = new CalendarTypeModel();
     $arrct = $ct->getAll();
     foreach ($arrct as $ct) {
         $arrc[$ct->cal_type_id] = $ct;
     }
     $cm->getByID(tin($id));
     $arr['entry'] = $cm;
     $arr['type'] = $arrc;
     $layout_id = "Calendar_id";
     $file = Layout::getFile($layout_id);
     //        echo "Pages/".$layout_id."/".$file;
     Mold::theme("Pages/" . $layout_id . "/" . $file, $arr);
     //        Mold::theme("Pages/Calendar_id",$arr);
 }
 function viewme($id, $classname, $classID)
 {
     $cm = new CalendarModel();
     $ct = new CalendarTypeModel();
     $arrct = $ct->getAll();
     foreach ($arrct as $ct) {
         $arrc[$ct->cal_type_id] = $ct;
     }
     $cm->getByID(tin($id));
     $arr['entry'] = $cm;
     $arr['type'] = $arrc;
     //        Mold::both("Calendar_id",$arr);
     pr($cm);
 }
 function loadEvents()
 {
     $cmd = new CalendarTypeModel();
     $arrA = $cmd->getWhere("cal_type_active = 1 ORDER BY cal_type_name ASC");
     $color = array();
     foreach ($arrA as $a) {
         $color[$a->cal_type_id] = $a->cal_type_color;
     }
     $cm = new CalendarModel();
     $arr = $cm->getAll();
     $hasil = array();
     foreach ($arr as $m) {
         $arr2 = array();
         $arr2['title'] = $m->cal_name;
         $arr2['start'] = $m->cal_begin;
         $arr2['end'] = $m->cal_end;
         $arr2['id'] = $m->cal_id;
         $arr2['backgroundColor'] = $color[$m->cal_type];
         if ($m->cal_allday) {
             $ad = true;
         } else {
             $ad = false;
         }
         $arr2['allDay'] = $ad;
         $hasil[] = $arr2;
     }
     echo json_encode($hasil);
     die;
 }