Esempio n. 1
0
 /**
  * Proceed to serach and returns the array of results, null if none 
  * found. All search options had been set yet.
  * 
  * @access public
  * @return array(CMS_resources_cms_news)
  */
 function search()
 {
     $items = array();
     if (!$this->_sql) {
         $this->_buildSQL();
     }
     $sql = str_replace('{{select}}', implode($this->_select, ','), $this->_sql);
     if ($this->_itemsPerPage > 0) {
         $sql .= "\n\t\t\tlimit\n\t\t\t\t" . $this->_page * $this->_itemsPerPage . ", " . $this->_itemsPerPage . "";
     }
     $q = new CMS_query($sql);
     if (!$q->getNumRows()) {
         return $items;
     }
     while ($data = $q->getArray()) {
         $obj = CMS_module_cms_forms::getResourceByID($data[0]);
         if (!$obj->hasError()) {
             $items[] = $obj;
         }
     }
     return $items;
 }
Esempio n. 2
0
}
$items_language = new CMS_language(CMS_session::getSessionVar("items_language"));
//
// Get default search options
//
// Get search options from posted datas
if ($_POST["cms_action"] == 'search') {
    CMS_session::setSessionVar("items_ctg", $_POST["items_ctg"]);
}
// +----------------------------------------------------------------------+
// | Actions                                                              |
// +----------------------------------------------------------------------+
switch ($_POST["cms_action"]) {
    case "delete":
        //change the article proposed location and send emails to all the validators
        $item = CMS_module_cms_forms::getResourceByID($_POST["item"]);
        if ($item->destroy()) {
            $cms_message = $cms_language->getMessage(MESSAGE_ACTION_OPERATION_DONE);
        } else {
            $cms_message = $cms_language->getMessage(MESSAGE_PAGE_ACTION_DELETE_ERROR, false, MOD_CMS_FORMS_CODENAME);
        }
        break;
}
// +----------------------------------------------------------------------+
// | Render                                                               |
// +----------------------------------------------------------------------+
$dialog = new CMS_dialog();
$content = '';
$dialog->setTitle($cms_language->getMessage(MESSAGE_PAGE_TITLE_MODULE, array($cms_module->getLabel($cms_language))) . " :: " . $cms_language->getMessage(MESSAGE_PAGE_TITLE));
//$dialog->setBacklink("index.php");
if ($cms_message) {