/** * 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 = RoleNotificationPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setMid($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setRoleId($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setNotification($arr[$keys[3]]); } }
function executeNotification(sfWebRequest $request) { $c = new Criteria(); $c->addAscendingOrderByColumn(RolePeer::TITLE); $this->role_list = RolePeer::doSelect($c); ///////////////////////////////////////// $c = new Criteria(); $c->addAscendingOrderByColumn(RoleNotificationPeer::MID); $this->notification_list = RoleNotificationPeer::doSelectJoinAll($c); ////////////////////////////////////////// }
/** * 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(RoleNotificationPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(RoleNotificationPeer::DATABASE_NAME); $criteria->add(RoleNotificationPeer::ID, $pks, Criteria::IN); $objs = RoleNotificationPeer::doSelect($criteria, $con); } return $objs; }
public function executeInstrumentNotication(sfWebRequest $request) { $c = new Criteria(); $c->add(PersonRolePeer::PERSON_ID, $this->getUser()->getId()); $c->addJoin(PersonRolePeer::ROLE_ID, RoleNotificationPeer::ROLE_ID); $personNotification = RoleNotificationPeer::doSelect($c); $this->mid = 0; foreach ($personNotification as $key => $value) { $this->mid = $value->getMid(); $this->notification = $value->getNotification(); //5. person add if ($this->mid == 5 && ($this->notification == 2 || $this->notification == 3)) { $c = new Criteria(); $c->addDescendingOrderByColumn(PersonPeer::ID); $c->setLimit(5); $this->newperson = PersonPeer::doSelect($c); } } $this->host = $request->getHost(); $this->memberId = $this->getUser()->getMemberId(); //$query = "SELECT COUNT(pilot_request.accepted) FROM pilot_request "; //$query .="WHERE pilot_request.accepted = 1 AND pilot_request.processed = 1 AND pilot_request.member_id = ".$this->memberId; //$con = Propel::getConnection(); //$stmt = $con->prepare($query); //$stmt->execute(); /*if($rs = $stmt->fetch(PDO::FETCH_NUM)) { $count = (int)$rs[0]; }else{ $count = 0; }*/ $c = new Criteria(); $c->add(PilotRequestPeer::ACCEPTED, 1); $c->add(PilotRequestPeer::PROCESSED, 1); $c->add(PilotRequestPeer::MEMBER_ID, $this->memberId); $this->totalAccepted = PilotRequestPeer::doCount($c); /* $this->memberId = $this->getUser()->getMemberId(); $query = "SELECT COUNT(pilot_request.accepted) FROM pilot_request "; $query .="WHERE pilot_request.accepted = 0 AND pilot_request.member_id = $this->memberId"; $con = Propel::getConnection(); $stmt = $con->prepare($query); $stmt->execute(); if($rs = $stmt->fetch(PDO::FETCH_NUM)) { $count = (int)$rs[0]; }else{ $count = 0; }*/ $c = new Criteria(); $c->add(PilotRequestPeer::ACCEPTED, 0); $c->add(PilotRequestPeer::MEMBER_ID, $this->memberId); $this->totaldeclined = PilotRequestPeer::doCount($c); $c = new Criteria(); $c->add(MissionLegPeer::PILOT_ID, $this->getUser()->getPilotId()); $c->add(MissionLegPeer::CANCEL_MISSION_LEG, 0); $this->totalMissionCancellation = MissionLegPeer::doCount($c); //total signup events count $pilot_id = $this->getUser()->getPilotId(); if ($pilot_id) { $pilot = PilotPeer::retrieveByPK($pilot_id); $member_id = $pilot->getMemberId(); $date = date('Y-m-d'); $c = new Criteria(); $c->add(EventReservationPeer::MEMBER_ID, $member_id, Criteria::EQUAL); $c->addJoin(EventPeer::ID, EventReservationPeer::EVENT_ID); $c->add(EventPeer::EVENT_DATE, $date, Criteria::GREATER_EQUAL); $this->totalSignupEvents = EventReservationPeer::doCount($c); } // }
function executeAddrole(sfWebRequest $request) { /*$c = new Criteria(); $c->add(RoleNotificationPeer::ID, $request->getParameter('rnid')); RoleNotificationPeer::doDelete($c); */ if (!$this->getUser()->hasCredential(array('Administrator'), false)) { $this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getReferer()); $this->redirect('dashboard/index'); } $isEmail = $request->getParameter('isemail'); $isInstrument = $request->getParameter('isinstrument'); $roleId = $request->getParameter('roleid'); $misType = $request->getParameter('mistype'); $divname = $request->getParameter('divname'); $c = new Criteria(); $c->add(RoleNotificationPeer::ROLE_ID, $roleId); $c->add(RoleNotificationPeer::MID, $misType); $role = RoleNotificationPeer::doSelect($c); $last_id = ""; if (count($role) == 0) { $rolenotification = new RoleNotification(); $rolenotification->setMid($misType); $rolenotification->setRoleId($roleId); $rolenotification->setNotification($this->getNotification($isEmail, $isInstrument)); $rolenotification->save(); $last_id = $rolenotification->getId(); } if (strlen($last_id) > 0) { $c = new Criteria(); $c->add(RoleNotificationPeer::ID, $last_id); $notification = RoleNotificationPeer::doSelectJoinAll($c); foreach ($notification as $nod) { ///////////////////////// if ($nod->getNotification() == "3") { $email = "checked"; $instnel = "checked"; } else { if ($nod->getNotification() == "2") { $email = ""; $instnel = "checked"; } else { if ($nod->getNotification() == "1") { $email = "checked"; $instnel = ""; } else { $email = ""; $instnel = ""; } } } ///////////////////////// $str = '<div id="rolid' . $last_id . '">' . '<table><tr><td width="' . '200' . '">' . $nod->getRole()->getTitle() . ' <span onclick="delRole(' . $nod->getId() . ')" style="cursor:pointer;color:red;"><b>X</b></span> <span>' . '</td><td>' . '<input name="isEmail" id="isEmail" value="1" type="checkbox" ' . $email . ' /> Email<input name="isInstrumental" id="isInstrumental" value="1" type="checkbox" ' . $instnel . ' /> Instrument Panel' . '<a href="#" class="link-edit" onclick="editrole(' . $nod->getId() . ',' . '"$divname"' . '); return false;" />Edit</a>' . '</td><tr></table>' . '</div>' . '<div id="' . $divname . '">' . '</div>'; } return $this->renderText($str); } else { return $this->renderText("1"); } //1 for unsuccess }