// one site for both adding and editing timesheet's log items
// besides the following lines show the possiblities of the dPframework
// retrieve GET-Parameters via dPframework
// please always use this way instead of hard code (e.g. there have been some problems with REGISTER_GLOBALS=OFF with hard code)
global $AppUI, $user_id, $percent;
$user_id = $AppUI->user_id;
$task_log_id = intval(dPgetParam($_GET, "task_log_id", 0));
$task_log_name = intval(dPgetParam($_GET, "task_log_name", 0));
// check permissions for this record
$canEdit = !getDenyEdit($m, $task_log_id);
if (!$canEdit) {
    $AppUI->redirect("m=public&a=access_denied");
}
// use the object oriented design of dP for loading the log that should be edited
// therefore create a new instance of the Timesheet Class
$obj = new CTimesheet();
$df = $AppUI->getPref('SHDATEFORMAT');
// pull users
// pull users
$q = new DBQuery();
$q->addTable('tasks', 't');
$q->addTable('projects', 'p');
$q->addTable('user_tasks', 'u');
$q->addQuery('t.task_id');
$q->addQuery('CONCAT_WS(" - ",p.project_short_name, t.task_name)');
$q->addOrder('p.project_short_name, t.task_name');
$q->addWhere('t.task_project = p.project_id and t.task_dynamic = 0 and t.task_percent_complete!=100 and u.task_id=t.task_id and u.user_id=' . $user_id);
//Devido a possibilidade de edição de registros, as tarefas de projetos arquivados e em espera serão apresentadas.
//$q->addWhere('p.project_status!=7 and p.project_status!=4');//[7] Projetos Arquivados e [4] Projetos Em Espera
$tasks = $q->loadHashList();
// load the record data in case of that this script is used to edit the log qith task_log_id (transmitted via GET)
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
// this doSQL script is called from the addedit.php script
// its purpose is to use the CTimesheet class to interoperate with the database (store, edit)
/* the following variables can be retreived via POST from timesheet/addedit.php:
** int task_log_id	is '0' if a new database object has to be stored or the id of an existing log that should be overwritten or deleted in the db
** str task_log_name	the text of the quote that should be stored
*/
// create a new instance of the einstein class
$obj = new CTimesheet();
$msg = '';
// reset the message string
// bind the informations (variables) retrieved via post to the einstein object
if (!$obj->bind($_POST)) {
    $AppUI->setMsg($obj->getError(), UI_MSG_ERROR);
    $AppUI->redirect();
}
if ($_POST['progresso']) {
    $id = $obj->task_log_task;
    $sql2 = "UPDATE tasks set task_percent_complete = 100 WHERE task_id=" . $id;
    db_exec($sql2);
}
if ($obj->task_log_task) {
    $id = $obj->task_log_task;
    $sql = "SELECT task_name FROM tasks WHERE task_id=" . $id;
示例#3
0
"><?php 
    echo $next;
    ?>
</a>
			<?php 
}
?>
		</td>
	</tr>
</table>


<?php 
$timesheetId = 0;
$status = 1;
$timesheet = new CTimesheet($user_id, $time_set->format('%Y%m%d'));
if ($timesheet->load()) {
    $timesheetId = $timesheet->getTimesheetId();
    $activities = $timesheet->getActivities();
}
?>
<!-- Create timesheet form -->
<form name="timesheetActivities" action="./index.php?m=activity&a=dosql" method="post">
<input name='timesheetId' type='hidden' value=<?php 
echo $timesheetId;
?>
 />
<input name='timeset' type='hidden' value=<?php 
echo $time_set->format('%Y%m%d');
?>
 />
示例#4
0
require_once "timesheet.class.php";
if (isset($_POST['submit'])) {
    $dataActivities = array();
    $params = array('userId', 'submit', 'timesheetId', 'timeset', 'newTaskIdList', 'projectLeaderTasksIdList');
    foreach ($_POST as $name => $value) {
        if (!in_array($name, $params)) {
            array_push($dataActivities, $value);
        }
    }
    if (isset($dataActivities)) {
        if ($_POST['timesheetId'] != 0) {
            $timesheetId = $_POST['timesheetId'];
        } else {
            //create timesheet
            $timesheet = new CTimesheet($_POST['userId'], $_POST['timeset']);
            $timesheetId = $timesheet->save();
        }
        CTimesheet::updateTaskTimesheet($timesheetId, $_POST['newTaskIdList']);
        CTimesheet::saveActivities($_POST['userId'], $dataActivities, $timesheetId);
    }
}
if (isset($_POST['validate'])) {
    if ($_POST['timesheetId']) {
        CTimesheet::validateTimesheet($_POST['timesheetId'], $_POST['projectLeaderTasksIdList']);
    }
}
if (isset($_POST['devalidate'])) {
    if ($_POST['timesheetId']) {
        CTimesheet::devalidateTimesheet($_POST['timesheetId'], $_POST['projectLeaderTasksIdList']);
    }