예제 #1
0
파일: edit_task.php 프로젝트: sudogem/brcms
    $optday .= '<option value ="' . $i . '">' . date("d", mktime(0, 0, 0, 0, $i, 0)) . '</option>';
}
// TODO: bai moi kindly change the year must be DYNAMIC!!
$optyear .= '<option value ="2006">' . date('Y') . '</option>';
$db = new database();
$sql = " select * from content_users where usertypeID=2 order by fullname asc";
//$sql = " select * from content_users order by fullname asc";
if (!($result = $db->query($sql))) {
    die('Error:' . $db->error());
}
$contentwriters = array();
while ($contentwriters[] = $db->fetcharray()) {
}
$totalrows = count($contentwriters);
$j = 1;
$quota = getActiveQuota();
for ($i = 0; $i < $totalrows; $i++) {
    if ($contentwriters[$i]->userID) {
        $i % 2 == 0 ? $bgcolor = "" : ($bgcolor = "#F5F5F5");
        $row_data .= '<tr class="tdhover" id= "tdata" bgcolor = "' . $bgcolor . '">';
        $row_data .= '<td>';
        $row_data .= $j++;
        $row_data .= '</td>';
        if ($contentwriters[$i]->userID == $assignedto) {
            $row_data .= '<td>';
            $row_data .= '<input type="radio" name="cid[]" id="cb' . $i . '" value="' . $contentwriters[$i]->userID . '" onClick="isChecked(this.checked)" checked/>';
            $row_data .= '</td>';
        } else {
            $row_data .= '<td>';
            $row_data .= '<input type="radio" name="cid[]" id="cb' . $i . '" value="' . $contentwriters[$i]->userID . '" onClick="isChecked(this.checked)" />';
            $row_data .= '</td>';
예제 #2
0
파일: save_task.php 프로젝트: sudogem/brcms
$created = simpledate(time());
$created_t = time();
if ($enddate < $startdate) {
    echo '<script>alert("Please input a valid date. ");history.go(-1);</script>';
    exit;
}
$priority = $_POST['priority'];
//$assignedto = $_POST['assignedto'];
$assignedto = $_POST['cid'][0];
$status = $_POST['status'];
$db = new database();
if (isset($_POST['save'])) {
    switch ($_POST['task']) {
        case 'add':
            $currentdate = time();
            $numtaskrequired = getActiveQuota();
            $isavailable = checkIfWriterIsAvailableToAssignedTheTask($assignedto, $currentdate, $numtaskrequired);
            if ($isavailable) {
                $sql = "INSERT INTO tasks VALUES('', '{$subject}', '{$description}', '{$startdate}', '{$enddate}', '{$priority}', '{$assignedto}', '{$created}', '{$status}', '{$created_t}' )";
                $_SESSION['task'] = 'add';
                $_SESSION['title'] = $subject;
                if (!($result = $db->query($sql))) {
                    die('Error:' . $db->error());
                }
            } else {
                echo '<script>alert("This person is already full to give a task. Please choose another writer to assigned the task. Thanks.");history.go(-1);</script>';
                exit;
            }
            break;
        case 'edit':
            $sql = "update tasks ";