} } //$content = file_rewrite_pluginfile_urls($project->content, 'pluginfile.php', $context->id, 'mod_project', 'content', $project->revision); $formatoptions = new stdClass(); $formatoptions->noclean = true; $formatoptions->overflowdiv = true; $formatoptions->context = $context; $members = array(); $tasks = array(); $members = getGroupMembers($currentgroup); //Get group members of the group, ID's and last access $tasks = getGroupsTasks($currentgroup); $html = "<a href='../chat/index.php?id=3'>Open Chat</a><br />"; $html .= "<table border=1><tr><td style='vertical-align:top;'><u>List of Tasks</u><br /><br />+ <a href='task_create.php'>NEW</a><br /><br />"; foreach ($tasks as $task) { $name = getStudentName($task->members); $html .= " - " . $task->name . " For: "; $name_size = count($name); $name_count = 0; foreach ($name as $assigned_name) { $html .= "<b>" . $assigned_name->username . "</b>"; if ($name_size - 1 != $name_count) { $html .= ", "; } $name_count++; } $html .= " Due: " . userdate($task->end_date); $html .= "<br />"; } $html .= "</td><td style='vertical-align:top;'><td><td><u>Group Members</u><br /><br />"; for ($i = 0; $i < count($members); $i++) {
function definition() { global $CFG, $DB; $task = $this->_customdata['task']; $project = $this->_customdata['project']; $members = $this->_customdata['members']; //$attachmentoptions = $this->_customdata['attachmentoptions']; $mform = $this->_form; if (!empty($task->id)) { $mform->addElement('header', 'general', get_string('tasks', 'mod_project')); $mform->addElement('html', 'Task Name: ' . $task->name . '<br />Task Description: ' . $task->description); } //TODO: Add Status Information if (isset($_GET['t'])) { //If Task already exists give status information $mform->addElement('header', 'status', get_string('task_status', 'mod_project')); $total_days = floor(($task->end_date - $task->start_date) / (60 * 60 * 24)); //Find the number of days $recommended_daily = ceil(1 / $total_days * 100); //Find how much % to do in a day $time_done = ceil((time() - $task->start_date) / (60 * 60 * 24)); //Find how many days into the task. $percentage_done = round($time_done / $total_days, 2) * 100; //Get the % $time_left = $task->end_date - time(); //Find the Time left //We only need to estimate the date of completion if they are not already done the task. if ($task->progress != 100) { if ($task->progress != 0) { //Calculate estimated due date, divide current progress by the amount of time into the task, then divide the remaining progress by that result $estimated_days = ceil((100 - $task->progress) / round($task->progress / $time_done, 2)); $estimated_date = userdate(time() + $estimated_days * (60 * 60 * 24), get_string('strftimedateshort', 'langconfig')); //Display the date nicely } else { //Cannot divide by zero progress, so we will set due date as estimated date. $estimated_date = userdate($task->end_date, get_string('strftimedateshort', 'langconfig')); } } if ($time_left < 0) { $time_left = 0; $recommended_daily = 100 - $task->progress; } $days_left = floor($time_left / (60 * 60 * 24)); //Determine Status Message and Progress bar colour if ($percentage_done <= $task->progress && time() < $task->end_date || $task->progress == 100) { $progress_bar_colour = '#0f0'; if ($task->progress == 100) { $standing = 'Task Completed. Good Work!'; } else { $standing = 'Good Standing. On track to finish on time.'; } } else { $progress_bar_colour = '#f00'; $standing = 'Bad Standing. Not on track to finish on time.'; } //Display elements on the webpage. $mform->addElement('html', '<div style="border: solid 1px;width: 300px;height: 10px;"><div style="background-color: ' . $progress_bar_colour . ';width:' . $task->progress . '%; height:10px;"> </div><div style="position: relative;top:-10px;text-align:center;font-size:10px;font-weight:bold;">Progress: ' . $task->progress . '%</div></div>'); $mform->addElement('html', '<br />Deadline: ' . userdate($task->end_date) . '<br />Days In: <b>' . $time_done . '</b> <br />Time Left: <b>' . $days_left . '</b> days <br >Recommended Daily Progress: <b>' . $recommended_daily . '%</b><br />'); if ($task->progress != 100) { $mform->addElement('html', 'Estimated date of completion: ' . $estimated_date . '<br />'); } $mform->addElement('html', '<br />' . $standing); $mform->setExpanded('status'); } //TODO: Add File Picker to Tasks $mform->addElement('header', 'files', get_string('files', 'mod_project')); //$mform->addElement('filepicker', 'userfile', get_string('file'), null, array('accepted_types' => '*')); $mform->setExpanded('files'); $mform->addElement('filemanager', 'attachment_filemanager', get_string('Attachments', 'mod_project'), null, array('accepted_types' => '*')); //$mform->addHelpButton('attachment_filemanager', 'attachment', 'project'); //Add User Feedback Comments to the tasks. $mform->addElement('header', 'feedback', get_string('feedback', 'mod_project')); $comments = getUsersComments($task->id); foreach ($comments as $comment) { $name = getStudentName($comment->student_id); $mform->addElement('html', userdate($comment->time, get_string('strftimedatetimeshort', 'langconfig')) . " - <b>" . $name[0]->username . "</b>: " . $comment->comment . "<br />"); } $mform->addElement('textarea', 'comments', get_string("comments", "mod_project"), 'wrap="virtual" rows="5" cols="50"'); $mform->setType('comments', PARAM_RAW); if (count($comments) > 0) { $mform->setExpanded('feedback'); } else { $mform->setExpanded('feedback', false); } $mform->addElement('hidden', 'id'); $mform->setType('id', PARAM_INT); $mform->addElement('hidden', 'cmid'); $mform->setType('cmid', PARAM_INT); $mform->addElement('hidden', 'project_id', $project->id); $mform->setType('project_id', PARAM_INT); $mform->addElement('hidden', 'group_id', $project->currentgroup); $mform->setType('group_id', PARAM_INT); $mform->addElement('hidden', 'cmid'); $mform->setType('cmid', PARAM_INT); $this->add_action_buttons(true); // set the defaults $this->set_data($task); }
} if ($displayList) { $studentId = $_REQUEST['student_id']; $query = "SELECT\r\n fee_id,\r\n amount,\r\n title,\r\n inserted_by,\r\n assigned_date AS assigned_date,\r\n due_date AS due_date,\r\n comment,\r\n waived,\r\n waived_by,\r\n waived_date\r\n FROM\r\n BILLING_FEE\r\n WHERE\r\n student_id = {$studentId}\r\n\r\n ORDER BY fee_id"; $trans_RET = DBGet(DBQuery($query)); $query = "SELECT SUM(amount) AS total_fee FROM BILLING_FEE WHERE student_id = {$studentId} and waived = 0;"; $totalFee = "0"; $fee_RET = DBGet(DBQuery($query)); if (!empty($fee_RET) && $fee_RET[1]['TOTAL_FEE'] != NULL) { $totalFee = $fee_RET[1]['TOTAL_FEE']; } /// Add a new action column to display if the fee is reversed or display the option to reverse it. foreach ($trans_RET as &$trans) { $action = ""; if ($trans['WAIVED']) { $action = '<b><font color=red>' . _('Waived') . '</font></b>'; } else { $action = button('x', '', "# onclick=javascript:window.location='Modules.php?modname={$_REQUEST['modname']}&modfunc=remove&student_id={$studentId}&fee_id={$trans['FEE_ID']}'"); } $trans['ACTION'] = $action; } $buttonAdd = button('add', '', "# onclick='javascript:window.open(\"Modules.php?modname={$_REQUEST['modname']}&modfunc=detail&student_id={$studentId}\",\r\n\t\t\t\"blank\",\"width=500,height=300\"); return false;'"); $link['add']['html'] = array('TITLE' => $buttonAdd, 'AMOUNT' => '', 'INSERTED_BY' => '', 'ASSIGNED_DATE' => '', 'DUE_DATE' => '', 'WAIVED_BY' => '', 'WAIVED_DATE' => '', 'COMMENT' => '', 'ACTION' => ''); //array_push($trans_RET,array('TITLE'=>$buttonAdd)); DrawHeader('<b>' . _('Student') . ': </b>' . getStudentName($studentId) . ' <b>' . _('Fee Balance') . ': </b>' . number_format($totalFee, 2)); ListOutput($trans_RET, array('TITLE' => _('Title'), 'AMOUNT' => _('Amount'), 'INSERTED_BY' => _('Inserted By'), 'ASSIGNED_DATE' => _('Assigned Date'), 'DUE_DATE' => _('Due Date'), 'WAIVED_BY' => _('Waived By'), 'WAIVED_DATE' => _('Waived Date'), 'COMMENT' => _('Comment'), 'ACTION' => _('Action')), _('Fee'), _('Fees'), $link); } if ($displaySearch) { Search('student_id'); } }