Exemplo n.º 1
0
 /**
  * Función que realiza una búsqueda de una tarea. Carga la vista "tasksearch".
  */
 public function Search()
 {
     if (isset($_POST["sr"])) {
         if (empty($_POST["description"]) && empty($_POST["c_date"]) && empty($_POST["status"])) {
             echo "No has buscado por ningún campo";
         } else {
             $query = "SELECT * FROM task WHERE ";
             $num = 0;
             if (!empty($_POST["c_date"])) {
                 $c_date = $_POST["c_date"];
                 $operator = $_POST["operator"];
                 if ($num != 0) {
                     $query .= " and ";
                 }
                 $query .= "c_date {$operator} '{$c_date}'";
                 $num++;
             }
             if (!empty($_POST["status"])) {
                 $status = $_POST["status"];
                 if ($num != 0) {
                     $query .= " and ";
                 }
                 $query .= "status = '{$status}'";
                 $num++;
             }
             if (!empty($_POST["description"])) {
                 $description = $_POST["description"];
                 if ($num != 0) {
                     $query .= " and ";
                 }
                 $query .= "description LIKE '%{$description}%'";
                 $num++;
             }
             $array = $this->model->TaskList(null, $query);
             $this->See('Resultados tareas', LoadView('taskview', array('list' => $array)));
         }
     } else {
         $this->See('Buscar', LoadView('tasksearch'));
     }
 }
Exemplo n.º 2
0
        } else {
            switch ($method) {
                case 'ComposeLeaderboardView':
                    $response['view'] = LoadView('leaderboard', $company_id);
                    $response['view']['trigger_function'] = 'Animate';
                    break;
                case 'ComposeSkyscraperView':
                    $response['view'] = LoadView('skyscraper', $company_id);
                    $response['view']['trigger_function'] = 'Animate';
                    break;
                case 'ComposeMPUView':
                    $response['view'] = LoadView('mpu', $company_id);
                    $response['view']['trigger_function'] = 'Animate';
                    break;
                case 'ComposeLargeView':
                    $response['view'] = LoadView('large', $company_id);
                    $response['view']['trigger_function'] = 'Animate';
                    break;
                default:
                    $error = Error(3, "Method '{$method}' not defined.");
            }
        }
    } else {
        $error = Error(2, "Malformed request. 'client_key' parameter missing.");
    }
} else {
    $error = Error(1, "Malformed request. 'method' parameter missing.");
}
$response['error'] = $error;
$response['timestamp'] = date('c');
echo json_encode($response);
Exemplo n.º 3
0
/**
* "Escribe" la función LoadView.
* @param $vista vista a cargar.
* @param viewsvar parametros de la vista.
*/
function ShowView($view, array $viewsvar = NULL)
{
    echo LoadView($view, $viewsvar);
}