public function summary()
 {
     # check token to make sure request from User that exist in database record
     if (true || User::isValidToken($_POST['token'])) {
         # create new object from schedule model
         $this->schedule = new \models\Schedule();
         $note = new Note();
         # retrieve note data from database and send the result
         $user_id = 1;
         //$_POST['user_id'];
         $result = array('status' => 'success', 'total_schedule' => $this->schedule->getTotalSchedule($user_id), 'total_incoming' => $this->schedule->getTotalIncoming($user_id), 'total_note' => $note->getTotalNote($user_id), 'incoming' => $this->schedule->getIncomingSchedule($user_id), 'today' => $this->schedule->getTodaySchedule($user_id), 'tomorrow' => $this->schedule->getTomorrowSchedule($user_id));
         Utils::prettyPrint(json_encode($result, JSON_PRETTY_PRINT));
     } else {
         # status will be restrict when token does not exist ini database record
         $result = array('status' => 'restrict');
         Utils::prettyPrint(json_encode($result, JSON_PRETTY_PRINT));
     }
 }
示例#2
0
 /**
  * Clears the current object, sets all attributes to their default values and removes
  * outgoing references as well as back-references (from other objects to this one. Results probably in a database
  * change of those foreign objects when you call `save` there).
  */
 public function clear()
 {
     if (null !== $this->aUser) {
         $this->aUser->removeComment($this);
     }
     if (null !== $this->aNote) {
         $this->aNote->removeComment($this);
     }
     $this->id = null;
     $this->user_id = null;
     $this->note_id = null;
     $this->text = null;
     $this->created_at = null;
     $this->updated_at = null;
     $this->alreadyInSave = false;
     $this->clearAllReferences();
     $this->resetModified();
     $this->setNew(true);
     $this->setDeleted(false);
 }
示例#3
0
 /**
  * Filter the query by a related \Models\Note object
  *
  * @param \Models\Note|ObjectCollection $note the related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildCategoryQuery The current query, for fluid interface
  */
 public function filterByNote($note, $comparison = null)
 {
     if ($note instanceof \Models\Note) {
         return $this->addUsingAlias(CategoryTableMap::COL_ID, $note->getCategoryId(), $comparison);
     } elseif ($note instanceof ObjectCollection) {
         return $this->useNoteQuery()->filterByPrimaryKeys($note->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByNote() only accepts arguments of type \\Models\\Note or Collection');
     }
 }
示例#4
0
 /**
  * Filter the query by a related \Models\Note object
  *
  * @param \Models\Note|ObjectCollection $note The related object(s) to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @throws \Propel\Runtime\Exception\PropelException
  *
  * @return ChildCommentQuery The current query, for fluid interface
  */
 public function filterByNote($note, $comparison = null)
 {
     if ($note instanceof \Models\Note) {
         return $this->addUsingAlias(CommentTableMap::COL_NOTE_ID, $note->getId(), $comparison);
     } elseif ($note instanceof ObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(CommentTableMap::COL_NOTE_ID, $note->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByNote() only accepts arguments of type \\Models\\Note or Collection');
     }
 }
示例#5
0
 /**
  * Initialize method for model.
  */
 public function initialize()
 {
     $this->hasMany('id', Note::className(), 'user_id', ['alias' => 'notes']);
 }
示例#6
0
 /**
  * Filter the query by a related \Models\Note object
  *
  * @param \Models\Note $note The related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @throws \Propel\Runtime\Exception\PropelException
  *
  * @return ChildSharedQuery The current query, for fluid interface
  */
 public function filterByNote($note, $comparison = null)
 {
     if ($note instanceof \Models\Note) {
         return $this->addUsingAlias(SharedTableMap::COL_WHAT_TYPE, 'note', $comparison)->addUsingAlias(SharedTableMap::COL_WHAT_ID, $note->getId(), $comparison);
     } else {
         throw new PropelException('filterByNote() only accepts arguments of type \\Models\\Note');
     }
 }
示例#7
0
 /**
  * @param ChildNote $note The ChildNote object to add.
  */
 protected function doAddNote(ChildNote $note)
 {
     $this->collNotes[] = $note;
     $note->setCategory($this);
 }
示例#8
0
 protected function create()
 {
     $params = $this->getAllowedKeysForCreate();
     $note = new Note();
     $note->fromArray($params);
     $category = $_POST['category'];
     $category = CategoryQuery::create()->filterByUser($this->params['user'])->filterByName($category)->findOne();
     if ($category != null) {
         $note->setCategory($category);
     }
     $note->setUser($this->params['user']);
     $note->save();
     $this->addFlash("success", "Note added");
     redirectTo($note->getShowPath());
 }
示例#9
0
 /**
  * Clears the current object, sets all attributes to their default values and removes
  * outgoing references as well as back-references (from other objects to this one. Results probably in a database
  * change of those foreign objects when you call `save` there).
  */
 public function clear()
 {
     if (null !== $this->aNote) {
         $this->aNote->removeShared($this);
     }
     if (null !== $this->aCategory) {
         $this->aCategory->removeShared($this);
     }
     if (null !== $this->aUser) {
         $this->aUser->removeShared($this);
     }
     if (null !== $this->aGroup) {
         $this->aGroup->removeShared($this);
     }
     $this->id = null;
     $this->what_id = null;
     $this->what_type = null;
     $this->to_id = null;
     $this->to_type = null;
     $this->rights = null;
     $this->created_at = null;
     $this->updated_at = null;
     $this->alreadyInSave = false;
     $this->clearAllReferences();
     $this->applyDefaultValues();
     $this->resetModified();
     $this->setNew(true);
     $this->setDeleted(false);
 }
示例#10
0
 /**
  * Exclude object from result
  *
  * @param   ChildNote $note Object to remove from the list of results
  *
  * @return $this|ChildNoteQuery The current query, for fluid interface
  */
 public function prune($note = null)
 {
     if ($note) {
         $this->addUsingAlias(NoteTableMap::COL_ID, $note->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
示例#11
0
 /**
  * Clears the current object, sets all attributes to their default values and removes
  * outgoing references as well as back-references (from other objects to this one. Results probably in a database
  * change of those foreign objects when you call `save` there).
  */
 public function clear()
 {
     if (null !== $this->aNote) {
         $this->aNote->removeSubNote($this);
     }
     $this->id = null;
     $this->note_id = null;
     $this->text = null;
     $this->state = null;
     $this->done_at = null;
     $this->created_at = null;
     $this->updated_at = null;
     $this->alreadyInSave = false;
     $this->clearAllReferences();
     $this->applyDefaultValues();
     $this->resetModified();
     $this->setNew(true);
     $this->setDeleted(false);
 }
示例#12
0
 /**
  * Clears the current object, sets all attributes to their default values and removes
  * outgoing references as well as back-references (from other objects to this one. Results probably in a database
  * change of those foreign objects when you call `save` there).
  */
 public function clear()
 {
     if (null !== $this->aUser) {
         $this->aUser->removeNotificationRelatedByUserId($this);
     }
     if (null !== $this->aOriginUser) {
         $this->aOriginUser->removeNotificationRelatedByOriginTypeOriginId($this);
     }
     if (null !== $this->aNote) {
         $this->aNote->removeNotification($this);
     }
     $this->id = null;
     $this->user_id = null;
     $this->origin_id = null;
     $this->origin_type = null;
     $this->type = null;
     $this->text = null;
     $this->created_at = null;
     $this->updated_at = null;
     $this->alreadyInSave = false;
     $this->clearAllReferences();
     $this->applyDefaultValues();
     $this->resetModified();
     $this->setNew(true);
     $this->setDeleted(false);
 }