Example #1
0
 public function testAllRetrieve()
 {
     self::authorizeFromEnv();
     $events = Event::all(array('limit' => 3, 'offset' => 0));
     if (count($events['data'])) {
         $event = Event::retrieve($events['data'][0]->id);
         $this->assertSame($events['data'][0]->id, $event->id);
     }
 }
Example #2
0
 public function index()
 {
     if ($this->getDates()) {
         $events = Event::where('start', '>=', $_GET['start'])->where('end', '<', $_GET['end'])->get();
         echo json_encode($events);
     } else {
         $events = Event::all();
         echo json_encode($events);
     }
 }
Example #3
0
 /**
  * @before _secure
  */
 public function all()
 {
     $this->noview();
     $results = Event::all(array("organization_id = ?" => Registry::get("session")->get("organization")->id));
     $events = array();
     foreach ($results as $r) {
         $events[] = array("title" => $r->title, "start" => $this->returnTime($r->start), "end" => $this->returnTime($r->start), "allDay" => $r->allDay ? true : false, "id" => $r->id, "className" => "event");
     }
     echo json_encode($events);
 }
Example #4
0
 /**
  * view
  * Retrieves rows from database.
  */
 public function view()
 {
     $res = new Response();
     $res->success = true;
     $res->message = "Loaded data";
     if (isset($_REQUEST['startDate'])) {
         $_SESSION[$GLOBALS['app_id']]['startDate'] = $_REQUEST['startDate'];
         $_SESSION[$GLOBALS['app_id']]['endDate'] = $_REQUEST['endDate'];
         $res->data = Event::range($_REQUEST['startDate'], $_REQUEST['endDate']);
     } else {
         $res->data = Event::all();
     }
     return $res->to_json();
 }
Example #5
0
 /**
  * view
  * Retrieves rows from database.
  */
 public function view()
 {
     $res = new Response();
     $res->success = true;
     $res->message = "Loaded data";
     //var_dump($this->request);
     if (isset($_REQUEST['start'])) {
         $this->startDate = $_REQUEST['start'];
         $this->endDate = $_REQUEST['end'];
         $res->data = Event::range($this->startDate, $this->endDate);
     } else {
         $res->data = Event::all();
     }
     return $res->to_json();
 }
Example #6
0
 public function __construct()
 {
     self::authorizeFromEnv();
     $this->data = array('parameters' => array("key" => "value"));
     $this->datas = array();
     // CRUD ___________________________________
     // Create
     for ($x = 0; $x <= 2; $x++) {
         $this->datas[] = Event::create($this->data);
     }
     $this->created = $this->datas[0];
     // Retrieve
     $this->retrieved = Event::retrieve($this->created->id);
     // Update
     // Delete
     $this->deleted = $this->created->delete();
     // List
     $this->order = Event::all(array("order" => "id"));
     $this->orderInv = Event::all(array("order" => "-id"));
     $this->limit5 = Event::all(array("limit" => "5", "order" => "id"));
     $this->limit1 = Event::all(array("start_after" => $this->limit5[1]->id, "end_before" => $this->limit5[3]->id));
     $this->oneId = Event::all(array("id" => $this->limit5[1]->id));
 }
 /**
  * Fetches events
  */
 function index()
 {
     $events = Event::all();
     header('Content-type:application/json');
     print json_encode($events);
 }
Example #8
0
 public function getTagsList($category)
 {
     switch ($category) {
         case 'Companies':
             return Companies::whereNull("Deleted")->orderBy('Company_Full_Name', 'asc')->get(['id_Company as id', 'Company_Full_Name as description'])->toJson();
         case 'People':
             return People::whereNull("Deleted")->orderBy('First_Name', 'asc')->get(['id_People as id', 'First_Name as description'])->toJson();
         case 'Vertical':
             return Vertical::all(['id_Vertical as id', 'Main_Description as description'])->toJson();
         case 'Products':
             return Products::whereNull("Deleted")->orderBy('Product_Title', 'asc')->get(['id_Product as id', 'Product_Title as description'])->toArray();
         case 'Events':
             return Event::all(['id_Event as id', 'Event_Title as description'])->toJson();
     }
 }
 public static function index()
 {
     self::check_logged_in();
     $events = Event::all();
     View::make('Event/index.html', array('events' => $events));
 }