예제 #1
0
 /**
  * Bulk loading vars
  *
  * @return void
  * @author Dan Cox
  */
 public function test_bulkLoad()
 {
     $this->params->load(array('bar' => 'foo', 'test' => 'value'));
     $this->assertTrue(isset($this->params->bar));
     $this->assertTrue(isset($this->params->test));
     $this->assertEquals('foo', $this->params->bar);
     $this->assertEquals('value', $this->params->test);
     $this->assertEquals(array('bar' => 'foo', 'test' => 'value'), $this->params->all());
 }
예제 #2
0
 public function label()
 {
     $charactor = Charactor::all();
     $scene = Scene::all();
     $object = Object::all();
     // dd('man');
     $price = Price::all();
     return View::make('pc.search')->with(array('errCode' => 0, 'message' => '返回标签', '_char' => $charactor, 'scene' => $scene, 'object' => $object, 'price' => $price));
 }
예제 #3
0
 public function label()
 {
     $charactor = Charactor::all();
     $scene = Scene::all();
     $object = Object::all();
     // dd('man');
     $price = Price::all();
     return Response::json(array('errCode' => 0, 'message' => '返回标签', '_char' => $charactor, 'scene' => $scene, 'object' => $object, 'price' => $price));
 }
 public function run()
 {
     DB::table('object_images')->delete();
     $objects = Object::all();
     foreach ($objects as $object) {
         ObjectImage::create(['object_id' => $object->id, 'image_name' => $this->copyImage(public_path() . '/backup_images/availability/first.png')]);
         ObjectImage::create(['object_id' => $object->id, 'image_name' => $this->copyImage(public_path() . '/backup_images/availability/second.png')]);
     }
 }
예제 #5
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     try {
         //$res = DB::connection('rmmysql')->select('select id, name, year from budgets');
         $res = Object::all();
         return Response::json($res);
     } catch (Exception $e) {
         return Response::json(array("status" => "ERROR", "data" => $e->getMessage()));
     }
 }
예제 #6
0
 /**
  * @brief exports a calendar and convert all times to UTC
  * @param integer $id id of the calendar
  * @return string
  */
 private static function calendar($id)
 {
     $events = Object::all($id);
     $calendar = Calendar::find($id);
     $return = "BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:ownCloud Calendar " . \OCP\App::getAppVersion(App::$appname) . "\nX-WR-CALNAME:" . $calendar['displayname'] . "\n";
     $return .= self::addVtimezone();
     foreach ($events as $event) {
         $return .= self::generateEvent($event);
     }
     $return .= "END:VCALENDAR";
     return $return;
 }
예제 #7
0
 public function set_location_id_phone()
 {
     $input = $this->request->all();
     $userEmail = DB::table('user_devices')->leftJoin('users', 'user_devices.user_id', '=', 'users.id')->where('access_token', $input['access_token'])->select('users.email')->first();
     if (!isset($input['location_id']) && !isset($input['phone_number'])) {
         response()->json(['action' => 'Check for the phone number and the location input', 'message' => 'Check for validation errors in the input'], 422);
     } else {
         $updateUser = $this->user->updateLocationAndPhone($input['user']->user_id, ['phone_number' => $input['phone_number'], 'location_id' => $input['location_id']]);
         $city_name = Location::where(['Type' => 'City', 'id' => $input['location_id']])->pluck('name');
         if (empty($city_name)) {
             $city_name = 'mumbai';
         }
         $city = ucfirst($city_name);
         $merge_vars = array('MERGE1' => $input['user']->full_name, 'GROUPINGS' => array(array('id' => 9713, 'groups' => [$city]), array('id' => 9705, 'groups' => [$city])), 'SIGNUPTP' => 'Facebook');
         $this->mailchimp->lists->subscribe($this->listId, ["email" => $userEmail->email], $merge_vars, "html", false, true);
         return response()->json($updateUser['data'], $updateUser['code']);
     }
 }
예제 #8
0
 /**
  * Grabs the current library definitions
  *
  * @return Array
  * @author Dan Cox
  */
 public function getLibraryDefinitions()
 {
     $this->library = new ServiceMockeryLibrary();
     return $this->library->all();
 }
예제 #9
0
 public function import()
 {
     if (!$this->isValid()) {
         return false;
     }
     $this->numofcomponents = count($this->calobject->getComponents());
     if ($this->overwrite === true) {
         foreach (Object::all($this->id) as $obj) {
             Object::delete($obj['id']);
         }
         //\OCP\Util::writeLog('calendarplus','DELETE MOD WUPPS FOUND: ', \OCP\Util::DEBUG);
     }
     //Check if a subscribed event is deleted
     $existObjects = [];
     foreach ($this->calobject->getComponents() as $object) {
         if (!$object instanceof \Sabre\VObject\Component\VEvent && !$object instanceof \Sabre\VObject\Component\VJournal && !$object instanceof \Sabre\VObject\Component\VTodo) {
             continue;
         }
         if ($this->bImportUri === true && $object instanceof \Sabre\VObject\Component\VTodo) {
             continue;
         }
         //refresh subscribed calendar check
         if ($this->bModified === true && !is_null($object->{'UID'})) {
             $testObject = Object::findByUID($object->{'UID'});
             $existObjects[$testObject['id']] = 1;
             if (isset($testObject['lastmodified']) && !is_null($object->{'LAST-MODIFIED'})) {
                 $importLastModified = strtotime($object->{'LAST-MODIFIED'});
                 if ($importLastModified > $testObject['lastmodified']) {
                     //Object::delete($testObject['id']);
                     $vcalendar = $this->createVCalendar($object->serialize(), $bAddtz);
                     Object::edit($testObject['id'], $vcalendar, true);
                     $this->abscount++;
                     continue;
                 }
                 if ($importLastModified == $testObject['lastmodified']) {
                     continue;
                 }
             }
         }
         if (!is_null($object->DTSTART)) {
             $dtend = Object::getDTEndFromVEvent($object);
             if ($object->DTEND) {
                 //$object->DTEND->setDateTime($dtend->getDateTime());
                 $dtend = $dtend->getDateTime();
                 $dtend->setTimeZone($object->DTSTART->getDateTime()->getTimeZone());
                 $object->DTEND->setDateTime($dtend);
             }
         }
         $bAddtz = false;
         if (!is_null($object->RRULE)) {
             $bAddtz = true;
         }
         if (is_null($object->CLASS)) {
             $object->CLASS = 'PUBLIC';
         }
         if (!is_null($object->SUMMARY)) {
             $this->currentSummary = 'Event ' . $object->SUMMARY;
         }
         $vcalendar = $this->createVCalendar($object->serialize(), $bAddtz);
         $insertid = Object::add($this->id, $vcalendar);
         $existObjects[$insertid] = 1;
         $this->abscount++;
         if ($this->bModified === false && $this->isDuplicate($insertid)) {
             Object::delete($insertid);
         } else {
             $this->count++;
         }
         $this->updateProgress(intval($this->abscount / $this->numofcomponents * 100));
     }
     $this->cache->remove($this->progresskey);
     if ($this->bModified === true) {
         foreach (Object::all($this->id) as $obj) {
             if (isset($existObjects[$obj['id']])) {
             } else {
                 Object::delete($obj['id']);
                 $this->abscount = 1;
             }
         }
     }
     return true;
 }
예제 #10
0
 /**
  * Add/Update a notification id for the device
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function notification()
 {
     $input = $this->request->all();
     $userDeviceNotification = $this->userDevices->addNotificationId($input);
     return response()->json($userDeviceNotification['data'], $userDeviceNotification['code']);
 }
예제 #11
0
 /**
  * @brief checks if a whole calendar is already cached
  * @param (int) id - id of the calendar
  * @return (bool)
  */
 public static function is_calendar_cached($id)
 {
     $cachedevents = count(self::getCalendar($id));
     $repeatingevents = 0;
     $allevents = Object::all($id);
     foreach ($allevents as $event) {
         if ($event['repeating'] === 1) {
             $repeatingevents++;
         }
     }
     if ($cachedevents < $repeatingevents) {
         return false;
     } else {
         return true;
     }
 }
예제 #12
0
 public function getAvailabilityEditPage($id = null)
 {
     $objects = Object::all();
     $availabilityPage = AvailabilityPage::first();
     $data = array('objects' => $objects, 'availabilityPage' => $availabilityPage);
     return View::make('admin.availability-default', $data);
 }
예제 #13
0
 public function import()
 {
     if (!$this->isValid()) {
         return false;
     }
     $numofcomponents = count($this->calobject->getComponents());
     if ($this->overwrite) {
         foreach (Object::all($this->id) as $obj) {
             Object::delete($obj['id']);
         }
     }
     foreach ($this->calobject->getComponents() as $object) {
         if (!$object instanceof \Sabre\VObject\Component\VEvent && !$object instanceof \Sabre\VObject\Component\VJournal && !$object instanceof \Sabre\VObject\Component\VTodo) {
             continue;
         }
         if (!is_null($object->DTSTART)) {
             $dtend = Object::getDTEndFromVEvent($object);
             if ($object->DTEND) {
                 //$object->DTEND->setDateTime($dtend->getDateTime());
                 $dtend = $dtend->getDateTime();
                 $dtend->setTimeZone($object->DTSTART->getDateTime()->getTimeZone());
                 $object->DTEND->setDateTime($dtend);
             }
         }
         $bAddtz = false;
         if (!is_null($object->RRULE)) {
             $bAddtz = true;
         }
         if (is_null($object->CLASS)) {
             $object->CLASS = 'PUBLIC';
         }
         $vcalendar = $this->createVCalendar($object->serialize(), $bAddtz);
         $insertid = Object::add($this->id, $vcalendar);
         $this->abscount++;
         if ($this->isDuplicate($insertid)) {
             Object::delete($insertid);
         } else {
             $this->count++;
         }
         $this->updateProgress(intval($this->abscount / $numofcomponents * 100));
     }
     $this->cache->remove($this->progresskey);
     return true;
 }