Ejemplo n.º 1
0
 public function getEvents(Request $request)
 {
     $start = date('Y-m-d H:i:s', $request->input('start'));
     $end = date('Y-m-d H:i:s', $request->input('end'));
     $article = Article::select('title', 'body', 'user_id', 'published_at as start', 'finished_at as end')->bycatslug('events')->where('published_at', '>=', $start)->where('finished_at', '<=', $end)->get();
     $json = array();
     if (count($article) > 0) {
         $i = 0;
         foreach ($article as $item) {
             $json[$i]['title'] = $item->title;
             $json[$i]['body'] = '<br><p>' . $item->body . '</p>';
             $json[$i]['start'] = badeStartDate(strtotime($item->start));
             $json[$i]['end'] = badeEndDate(strtotime($item->end));
             if (strtotime($item->end) < time()) {
                 $json[$i]['color'] = "#CCC";
             }
             if (strtotime($item->start) > time()) {
                 if ($item->user_id == $request->user()->id) {
                     $json[$i]['color'] = "green";
                 } else {
                     $json[$i]['color'] = "#C09";
                 }
             }
             $i++;
         }
         if (count($json) > 0) {
             return json_encode($json, JSON_UNESCAPED_UNICODE);
         } else {
             return 0;
         }
     }
     return 0;
 }
Ejemplo n.º 2
0
                 $registry['banners_added'][$item['cat_id']]['cat'] = $item['cat_id'];
                 $registry['banners_added'][$item['cat_id']]['published'] = $item['published_at'];
                 $registry['banners_added'][$item['cat_id']]['finished'] = $item['finished_at'];
             }
         }
     }
 }
 if (count($registry['rubrics']) > 0) {
     $start_new = strtotime('2015-09-1');
     $i = 0;
     foreach ($registry['rubrics'] as $item) {
         $users = unserialize($item['users']);
         $group = unserialize($news[$item['date']]['group']);
         $result[$i]['title'] = '<div onClick="window.open(\'/' . $item['cat_chpu'] . '/' . $news[$item['date']]['chpu'] . '/\');">' . $item['name'] . '</div>';
         $result[$i]['start'] = badeStartDate($item['date']);
         $result[$i]['end'] = badeEndDate($item['date']);
         $checked = $item['img'] > 0 ? 'checked' : '';
         $value = $item['img'] <= 0 ? 1 : 0;
         $fb_val = $item['fb'] <= 0 ? 1 : 0;
         $fb_checked = $item['fb'] > 0 ? 'checked' : '';
         if (!$news[$item['date']]['id']) {
             if ($user->get_property('gid') == 18) {
                 if (in_array($user->get_property('userID'), $users)) {
                     $result[$i]['color'] = 'red';
                     $result[$i]['title'] = '<div onClick="window.open(\'/apanel/index.php?component=article&section=add&cat=' . $item['id'] . '&Y=' . date('Y', $item['date']) . '&M=' . date('m', $item['date']) . '&D=' . date('d', $item['date']) . '&H=' . date('H', $item['date']) . '&I=' . date('i', $item['date']) . '\');">' . $item['name'] . '</div>';
                     $result[$i]['title'] .= '<input onClick="checkImage(' . $item['date'] . ',' . $item['id'] . ',jQuery(this),\'image\')" type="checkbox" name="img" value="' . $value . '" ' . $checked . '/>';
                 } else {
                     $result[$i]['color'] = 'grey';
                 }
             } else {
                 $result[$i]['color'] = 'grey';