Beispiel #1
0
 function lookup($id)
 {
     return $id && is_numeric($id) && ($dept = new Dept($id)) && $dept->getId() == $id ? $dept : null;
 }
Beispiel #2
0
                        $errors['err']='Unable to fetch info on rep ID#'.$id;
                    }
                }
                $page=($staff or ($_REQUEST['a']=='new' && !$uID))?'staff.inc.php':'staffmembers.inc.php';
                break;
            default:
                $page='staffmembers.inc.php';
        }
        break;
    //Departments
    case 'dept': //lazy
    case 'depts':
        $dept=null;
        if(($id=$_REQUEST['id']?$_REQUEST['id']:$_POST['dept_id']) && is_numeric($id)) {
            $dept= new Dept($id);
            if(!$dept || !$dept->getId()) {
                $dept=null;
                $errors['err']='Unable to fetch info on Dept ID#'.$id;
            }
        }
        $page=($dept or ($_REQUEST['a']=='new' && !$deptID))?'dept.inc.php':'depts.inc.php';
        $nav->setTabActive('depts');
        $nav->addSubMenu(array('desc'=>'Departments','href'=>'admin.php?t=depts','iconclass'=>'departments'));
        $nav->addSubMenu(array('desc'=>'Add New Dept.','href'=>'admin.php?t=depts&a=new','iconclass'=>'newDepartment'));
        break;
    // (default)
    default:
        $page='pref.inc.php';
}
//========================= END ADMIN PAGE LOGIC ==============================//
 /**
  * Filter the query by a related Dept object
  *
  * @param     Dept|PropelCollection $dept The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return    CourseQuery The current query, for fluid interface
  */
 public function filterByDept($dept, $comparison = null)
 {
     if ($dept instanceof Dept) {
         return $this->addUsingAlias(CoursePeer::DEPT_ID, $dept->getId(), $comparison);
     } elseif ($dept instanceof PropelCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(CoursePeer::DEPT_ID, $dept->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByDept() only accepts arguments of type Dept or PropelCollection');
     }
 }
 /**
  * Declares an association between this object and a Dept object.
  *
  * @param      Dept $v
  * @return     Course The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setDept(Dept $v = null)
 {
     if ($v === null) {
         $this->setDeptId(NULL);
     } else {
         $this->setDeptId($v->getId());
     }
     $this->aDept = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Dept object, it will not be re-added.
     if ($v !== null) {
         $v->addCourse($this);
     }
     return $this;
 }
Beispiel #5
0
 /**
  * Handler for add new dept
  */
 public function actionAddDept()
 {
     $user = $_REQUEST['user'][0];
     $sum = $_REQUEST['sum'][0];
     $comment = $_REQUEST['comment'][0];
     $date = $_REQUEST['date'][0];
     $time = $_REQUEST['time'][0];
     $attributs = array();
     if ($user != '') {
         $attributs['user_id'] = $user;
     }
     if ($sum != '') {
         $attributs['sum'] = $sum;
     }
     if ($comment != '') {
         $attributs['comment'] = $comment;
     }
     if ($date != '' && $time != '') {
         $attributs['comment'] = $date . ' ' . $time;
     }
     if (isset($_REQUEST['id'])) {
         $id = $_REQUEST['id'];
         $attributs['id'] = $id;
     }
     $dept = new Dept($attributs);
     $dept->save();
     $id = $dept->getId();
     $this->showResponse(array('status' => true, 'id' => $id));
 }
 /**
  * Exclude object from result
  *
  * @param     Dept $dept Object to remove from the list of results
  *
  * @return    DeptQuery The current query, for fluid interface
  */
 public function prune($dept = null)
 {
     if ($dept) {
         $this->addUsingAlias(DeptPeer::ID, $dept->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }