コード例 #1
0
ファイル: components.class.php プロジェクト: yasirgit/afids
 public function executeTeamNotepad(sfWebRequest $request)
 {
     $this->person_role = PersonRolePeer::getByPersonIdOne($this->getUser()->getId());
     $s_role = RolePeer::getByTitle('Staff');
     $a_role = RolePeer::getByTitle('Administrator');
     $role_ids = array();
     //    foreach ($person_roles as $person_role){
     //      $roleId = $person_role->getRoleId();
     //      $s_role_id = $s_role->getId();
     //      if($roleId==$s_role_id){
     //        $role_ids[] = $a_role->getId();
     //      }else{
     //        $role_ids[] = $roleId;
     //      }
     //    }
     $team_notes = "";
     if ($this->person_role) {
         $team_notes = TeamNotePeer::getTeamNote();
     }
     $this->team_notes = $team_notes;
     $this->allowed_tags = $this->getAllowedTags();
 }
コード例 #2
0
ファイル: BaseTeamNote.php プロジェクト: yasirgit/afids
 /**
  * Populates the object using an array.
  *
  * This is particularly useful when populating an object from one of the
  * request arrays (e.g. $_POST).  This method goes through the column
  * names, checking to see whether a matching key exists in populated
  * array. If so the setByName() method is called for that column.
  *
  * You can specify the key type of the array by additionally passing one
  * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  * The default key type is the column's phpname (e.g. 'AuthorId')
  *
  * @param      array  $arr     An array to populate the object from.
  * @param      string $keyType The type of keys the array uses.
  * @return     void
  */
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = TeamNotePeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setRoleId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setNote($arr[$keys[1]]);
     }
 }
コード例 #3
0
ファイル: BaseRole.php プロジェクト: yasirgit/afids
 /**
  * Gets a single TeamNote object, which is related to this object by a one-to-one relationship.
  *
  * @param      PropelPDO $con
  * @return     TeamNote
  * @throws     PropelException
  */
 public function getTeamNote(PropelPDO $con = null)
 {
     if ($this->singleTeamNote === null && !$this->isNew()) {
         $this->singleTeamNote = TeamNotePeer::retrieveByPK($this->id, $con);
     }
     return $this->singleTeamNote;
 }
コード例 #4
0
ファイル: actions.class.php プロジェクト: yasirgit/afids
 public function executeSaveTeamNote(sfWebRequest $request)
 {
     $note = $request->getParameter('note');
     $a_role = RolePeer::getByTitle('Admin');
     $id = $a_role->getId();
     # validate
     //$c = new Criteria();
     //$c->add(PersonRolePeer::PERSON_ID, $this->getUser()->getId());
     //$c->add(PersonRolePeer::ROLE_ID, $id);
     //if (PersonRolePeer::doCount($c) == 0) $this->forward404();
     # save
     $team_note = TeamNotePeer::retrieveByPK($id);
     if (!$team_note) {
         $team_note = new TeamNote();
     }
     $team_note->setRoleId($id);
     $team_note->setNote(strip_tags($note, sfConfig::get('app_allowed_note_tags')));
     $team_note->save();
     return sfView::NONE;
 }
コード例 #5
0
ファイル: BaseTeamNotePeer.php プロジェクト: yasirgit/afids
 /**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      PropelPDO $con the connection to use
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function retrieveByPKs($pks, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(TeamNotePeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(TeamNotePeer::DATABASE_NAME);
         $criteria->add(TeamNotePeer::ROLE_ID, $pks, Criteria::IN);
         $objs = TeamNotePeer::doSelect($criteria, $con);
     }
     return $objs;
 }
コード例 #6
0
ファイル: BaseRolePeer.php プロジェクト: yasirgit/afids
 /**
  * This is a method for emulating ON DELETE CASCADE for DBs that don't support this
  * feature (like MySQL or SQLite).
  *
  * This method is not very speedy because it must perform a query first to get
  * the implicated records and then perform the deletes by calling those Peer classes.
  *
  * This method should be used within a transaction if possible.
  *
  * @param      Criteria $criteria
  * @param      PropelPDO $con
  * @return     int The number of affected rows (if supported by underlying database driver).
  */
 protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con)
 {
     // initialize var to track total num of affected rows
     $affectedRows = 0;
     // first find the objects that are implicated by the $criteria
     $objects = RolePeer::doSelect($criteria, $con);
     foreach ($objects as $obj) {
         // delete related RolePermissionBackup objects
         $c = new Criteria(RolePermissionBackupPeer::DATABASE_NAME);
         $c->add(RolePermissionBackupPeer::ROLE_ID, $obj->getId());
         $affectedRows += RolePermissionBackupPeer::doDelete($c, $con);
         // delete related TeamNote objects
         $c = new Criteria(TeamNotePeer::DATABASE_NAME);
         $c->add(TeamNotePeer::ROLE_ID, $obj->getId());
         $affectedRows += TeamNotePeer::doDelete($c, $con);
     }
     return $affectedRows;
 }