Exemplo n.º 1
0
 public function createAction()
 {
     $entity = new Faq();
     $entity->load_from_array($this->request->getParam("faq"));
     if (save_faq($entity)) {
         $this->flash->setSuccess("New Question added successfully!");
         $this->redirect_to(project_show_path($entity->project_id));
     } else {
         $this->flash->setError("There was an error saving the question. Both fields are required.");
         //$this->render(array("entity" => $entity), "new");
         $this->redirect_to(project_show_path($entity->project_id));
     }
 }
Exemplo n.º 2
0
Arquivo: Faq.php Projeto: quyen91/lfpr
/** 
Retrieves a list of Faq
@order = Optional, can be an array of keys or just a single key to order by the results
@limit = Optional
*/
function list_faq($order = null, $limit = null, $where = null)
{
    global $__db_conn;
    $sql = "SELECT * FROM faq";
    if ($where != null) {
        $sql .= " WHERE " . $where;
    }
    if ($order != null) {
        $order_str = $order;
        if (is_array($order)) {
            $order_str = implode(",", $order);
        }
        $sql .= " order by {$order_str}";
    }
    if ($limit != null) {
        $sql .= " limit {$limit}";
    }
    $result = mysql_query($sql, $__db_conn);
    if (!$result) {
        Makiavelo::info("Mysql error: " . mysql_error() . "::" . $sql);
    }
    $results = array();
    while ($row = mysql_fetch_assoc($result)) {
        $tmp = new Faq();
        $tmp->load_from_array($row);
        $results[] = $tmp;
    }
    return $results;
}