Exemple #1
0
function photo_POST($id)
{
    $teacher = new Teacher($id);
    $src = make_image('photo');
    $teacher->update('photo', $src);
    redirect("teacher/{$id}");
}
function edit_teacher_POST($id)
{
    $description = _post('description');
    $teacher = new Teacher($id);
    if ($description) {
        $teacher->update('description', $description);
    }
    redirect("teacher/{$id}/edit");
}
 /**
  * Creates Indicate2 person context by teacher data
  *
  * @param array 			$teacherData 	Teacher data (intern)
  * @param boolean=true 	$dbAction 		Update person context id
  *
  * @return int
  * 
  * @throws Indicate2_Exception
  */
 public function createPersonContext($teacherData, $dbAction = true)
 {
     try {
         if (empty($this->_client)) {
             $this->connect();
         }
         $teacherPrefix = getTeacherPrefix();
         $teacherModel = new Teacher();
         // create request
         $createPersonContextRequest = array('CreatePersonContextRequest' => array('PersonContext' => array('Name' => $teacherModel->getNameByData($teacherData), 'Description' => ($divisionLongname = $teacherModel->getDivisionByData($teacherData)) ? $divisionLongname : '', 'Image' => $teacherData[$teacherPrefix . 'photo'], 'PageBreak' => false)));
         // call public function to create person context
         $response = $this->_client->__soapCall('CreatePersonContext', $createPersonContextRequest);
         if ($dbAction) {
             // write new person context id from indicate2 to teacher in tuevalon2
             $teacherModel->update(array($teacherPrefix . 'indicate2personcontextid' => intval($response->ContextId)), array($teacherPrefix . 'id = ' . intval($teacherData[$teacherPrefix . 'id']), $teacherPrefix . 'indicate2ws = ' . $teacherModel->getAdapter()->quote(getIndicate2WSDL()), $teacherPrefix . 'indicate2user = ' . $teacherModel->getAdapter()->quote(getIndicate2User())));
         }
         return $response->ContextId;
     } catch (Exception $e) {
         throw new Indicate2_Exception($e->getMessage());
     }
 }
Exemple #4
0
<?php

require_once "../init.php";
$teacher = new Teacher(new PDOdb("mysql:host=localhost;dbname=usjr", "root", ""));
$teacherid = $_POST['tchid'];
$teacherfname = $_POST['tchfname'];
$teachermname = $_POST['tchmname'];
$teacherlname = $_POST['tchlname'];
$teachertitle = $_POST['tchtitle'];
$teachertype = $_POST['tchtype'];
$result = $teacher->update(array('teacherfname' => $teacherfname, 'teachermname' => $teachermname, 'teacherlname' => $teacherlname, 'teachertitle' => $teachertitle, 'teachertype' => $teachertype), array('teacherid' => $teacherid), 1);
header('Location:teacherUpdateList.php');