Esempio n. 1
0
 }
 $data["pro_descripcion"] = nl2br($app->getRequest()->post('pro_descripcion'));
 if (empty($data["pro_descripcion"]) || strlen($data["pro_descripcion"]) < 150 || strlen($data["pro_descripcion"]) > 500) {
     $error = true;
 }
 $data["pro_cant"] = intval($app->getRequest()->post('pro_quant'));
 if (!empty($data["pro_cant"]) && !is_numeric($data["pro_cant"])) {
     $error = true;
 }
 //No required at update
 //$proLength = $app->getRequest()->post('pro_length');
 $data["pro_category"] = intval($app->getRequest()->post('pro_category'));
 if (empty($data["pro_category"])) {
     $error = true;
 } else {
     $category->events = CategoriesEvent::getListByCategory($data["pro_type"]);
     $events = array();
     foreach ($category->events as $catEvent) {
         $events[] = $catEvent->id;
     }
     if (!in_array($data["pro_category"], $events)) {
         $error = true;
     }
 }
 $data["pro_date"] = $app->getRequest()->post('project_date');
 if (empty($data["pro_date"]) || DateHelper::validateDate($data["pro_date"]) == false) {
     $error = true;
 }
 $data["pro_date"] = str_replace('/', '-', $data["pro_date"]);
 $data["pro_date"] = date('Y-m-d H:i:s', strtotime($data["pro_date"]));
 /* Recalculate project max adjudication date */
Esempio n. 2
0
    $project = $projectModel->loadById($id);
    //Validate conditions
    if (!$project || !$projectModel->canBeModified($project, $currentUser)) {
        //Invalid project
        $isEdit = false;
    }
    if ($isEdit) {
        //prepare fields
        $project->pro_date = $app->getHelper('DateHelper')->getShortDate($project->pro_date, 'd/m/Y');
        $project->pro_deadline = !empty($project->pro_deadline) ? $app->getHelper('DateHelper')->getShortDate($project->pro_deadline, 'd/m/Y') : '';
    }
}
//TODO validate categoria del proyecto client side
$mainCategories = Category::loadCategories();
foreach ($mainCategories as $category) {
    $category->events = CategoriesEvent::getListByCategory($category->id);
}
$countries = Country::loadCountries();
$session = validaSession();
$project->pro_type = '2';
?>

<div class="content-container">
    <div class="content form-page">

        <?php 
//var_dump($app->getInput()->errors());
?>

        <?php 
if ($isEdit) {