コード例 #1
0
ファイル: _matching_legs.php プロジェクト: yasirgit/afids
                $dis = 'none';
                ?>
 <?php 
            }
            ?>
 <!--END RETURN HOME LEG--></div>
<!-- END BG--></div>
<!-- END FRAME--></div>
<!-- Location matches info-->
<ul class="discussion">
	<li><a href="javascript:showDiscussions(<?php 
            echo $leg->getId();
            ?>
)">Discussion
	<?php 
            $leg_discussions = DiscussionPeer::getByLegID($leg->getId());
            $isSplitMission = false;
            if (isset($leg_discussions)) {
                $count = 0;
                foreach ($leg_discussions as $discussion) {
                    $count++;
                    if ($discussion->getIsSplit()) {
                        $isSplitMission = true;
                    }
                }
                if ($count > 0) {
                    echo '( ' . $count . ' )';
                }
            }
            ?>
 <?php 
コード例 #2
0
ファイル: actions.class.php プロジェクト: yasirgit/afids
 /**
  * Mission Leg
  * CODE:mission_leg_delete
  */
 public function executeDelete(sfWebRequest $request)
 {
     #Security
     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');
     }
     if ($request->getParameter('id')) {
         $suc = '';
         $suc2 = '';
         $mission_leg = MissionLegPeer::retrieveByPK($request->getParameter('id'));
         if (isset($mission_leg)) {
             $has_pilot_req = PilotRequestPeer::getByLegId($mission_leg->getId());
             if (isset($has_pilot_req) && $has_pilot_req instanceof PilotRequest) {
                 //try{
                 $has_pilot_req->delete();
                 $suc = ' And Pilot request #' . $has_pilot_req->getId() . ' has deleted!';
                 //}catch (Exception $e){echo "exception-1";}
             }
             $has_discussions = DiscussionPeer::getByLegID($mission_leg->getId());
             if (isset($has_discussions)) {
                 foreach ($has_discussions as $dis) {
                     //try{
                     $dis->delete();
                     //}catch (Exception $e){echo "exception-2";}
                 }
                 $suc2 = ' And Leg\'s Discussion(s) has deleted!';
             }
         }
         if (isset($mission_leg) && $mission_leg instanceof MissionLeg) {
             try {
                 $miss_id = $mission_leg->getMissionId();
                 $miss_leg_d = $mission_leg->getLegNumber();
                 $mission_leg->delete();
                 $mission_legs = MissionLegPeer::getbyMissId($miss_id);
                 if ($mission_legs) {
                     foreach ($mission_legs as $mleg) {
                         if ($mleg->getLegNumber() > $miss_leg_d) {
                             $mleg->setLegNumber($mleg->getLegNumber() - 1);
                             $mleg->save();
                         }
                     }
                 }
             } catch (Exception $e) {
                 $this->getUser()->setFlash('warning', "There are related persons to this mission leg. Please remove them first.");
             }
             $this->getUser()->setFlash('success', 'Missin Leg # ' . $mission_leg->getId() . ' has successfully deleted!' . $suc . $suc2);
             //}catch (Exception $e){ echo "exception-3";}
             if ($request->getReferer()) {
                 $this->redirect($request->getReferer());
             } else {
                 $this->redirect('leg');
             }
         }
     }
 }
コード例 #3
0
ファイル: BaseDiscussion.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 = DiscussionPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setUserId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setLegId($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setComment($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setCreatedAt($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setIsSplit($arr[$keys[5]]);
     }
 }
コード例 #4
0
ファイル: BaseDiscussionPeer.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(DiscussionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(DiscussionPeer::DATABASE_NAME);
         $criteria->add(DiscussionPeer::ID, $pks, Criteria::IN);
         $objs = DiscussionPeer::doSelect($criteria, $con);
     }
     return $objs;
 }