예제 #1
0
 /**
  * Get Request Handler
  *
  * This method is called when a request is a GET
  *
  * @return array
  */
 public function executeGet()
 {
     $valid = $this->hasRequiredParameters($this->requiredParams);
     if ($valid instanceof Frapi_Error) {
         return $valid;
     }
     $username = $this->getParam('username');
     $password = $this->getParam('password');
     $task_id = $this->getParam('task_id', self::TYPE_INT);
     // Attempt to login as user, a little bit of a hack as we currently
     // require the $_POST['login'] var to be set as well as a global AppUI
     $AppUI = new CAppUI();
     $GLOBALS['AppUI'] = $AppUI;
     $_POST['login'] = '******';
     if (!$AppUI->login($username, $password)) {
         throw new Frapi_Error('INVALID_LOGIN');
     }
     $task = new CTask();
     $allowed_tasks = $task->getAllowedRecords($AppUI->user_id);
     // Task ID  is the key, so lets get them in to an array so we can
     // easily check
     $allowed_tasks = array_keys($allowed_tasks);
     if (!in_array($task_id, $allowed_tasks)) {
         throw new Frapi_Error('PERMISSION_ERROR');
     }
     // User has permission so load the project for display
     $task_departments = $task->getTaskDepartments($AppUI, $task_id);
     $task_contacts = $task->getTaskContacts($AppUI, $task_id);
     $task = (array) $task->load($task_id);
     $task['task_departments'] = array();
     foreach ($task_departments as $key => $value) {
         $task['task_departments'][] = $value['dept_id'];
     }
     $task['task_contacts'] = array();
     foreach ($task_contacts as $key => $value) {
         $task['task_contacts'][] = $value['contact_id'];
     }
     // Remove the data that is not for display
     unset($task['_tbl_prefix'], $task['_tbl'], $task['_tbl_key'], $task['_error'], $task['_query'], $task['_tbl_module']);
     $this->data['task'] = $task;
     $this->data['success'] = true;
     $this->setTemplateFileName('Task');
     return $this->toArray();
 }
예제 #2
0
파일: view.php 프로젝트: joly/web2project
	    <tr>
	    	<td colspan="3" class="hilite">
	    		<?php 
    foreach ($depts as $dept_id => $dept_info) {
        echo '<div>' . $dept_info['dept_name'];
        if ($dept_info['dept_phone'] != '') {
            echo '( ' . $dept_info['dept_phone'] . ' )';
        }
        echo '</div>';
    }
    ?>
	    	</td>
	    </tr>
		<?php 
}
$contacts = $obj->getTaskContacts($AppUI, $task_id);
if (count($contacts) > 0) {
    ?>
	    <tr>
	    	<td><strong><?php 
    echo $AppUI->_('Task Contacts');
    ?>
</strong></td>
	    </tr>
	    <tr>
	    	<td colspan="3" class="hilite">
					<?php 
    echo '<table cellspacing="1" cellpadding="2" border="0" width="100%" bgcolor="black">';
    echo '<tr><th>' . $AppUI->_('Name') . '</font></th><th>' . $AppUI->_('Email') . '</th><th>' . $AppUI->_('Phone') . '</th><th>' . $AppUI->_('Department') . '</th></tr>';
    foreach ($contacts as $contact_id => $contact_data) {
        echo '<tr>';