Esempio n. 1
0
File: admin.php Progetto: demental/m
 public function doExecApplier()
 {
     $form = new MyQuickForm('applyform', 'POST', M_Office::URL());
     $opts = M::tablesWithPlugin('tag');
     $opts = array_combine($opts, $opts);
     $form->addElement('select', 'table', 'Table', $opts);
     $form->addElement('textarea', 'clause', 'clause', 'rows="4" cols="60"');
     $form->addElement('text', 'tagname', 'tagname');
     $form->addElement('text', 'tagdel', 'tagdel');
     $form->addElement('checkbox', 'distinct', 'distinct');
     $form->addElement('submit', '__submit__', 'Apply');
     $form->addFormRule(array($this, 'checkApplier'));
     if ($form->validate()) {
         @set_time_limit(0);
         ini_set('memory_limit', '1024M');
         $values = $form->exportValues();
         $t = DB_DataObject::factory($values['table']);
         $query = 'SELECT ' . ($values['distinct'] ? 'DISTINCT ' : ' ') . $values['table'] . '.* FROM ' . $values['table'] . ' ' . $values['clause'];
         $t->query($query);
         while ($t->fetch()) {
             if ($values['tagname']) {
                 $t->addTag($values['tagname']);
             }
             if ($values['tagdel']) {
                 $t->removeTag($values['tagdel']);
             }
             $applied++;
         }
         $this->assign('success', 1);
         $this->assign('applied', $applied);
     }
     $this->assign('form', $form);
 }
Esempio n. 2
0
 public function abschliessen()
 {
     for ($i = 0; $i < count($this->questionCollection->questionPages); $i++) {
         if (!$_SESSION['pages_filled'][$i + 1]) {
             header("Location: " . APP_BASE_URL . "fragen/seite/" . ($i + 1));
         }
     }
     $tmvc = tmvc::instance();
     $form = new MyQuickForm('form_finish', 'post', APP_BASE_URL . 'fragen/abschliessen', '', '', true);
     if ($form->validate()) {
         DBfunctions::getInstance()->doSingleCall("DELETE FROM t_person_properties WHERE person_id=?", "i", $_SESSION['person_id']);
         foreach ($_SESSION['properties'] as $prop => $val) {
             DBfunctions::getInstance()->doSingleCall("INSERT INTO t_person_properties(person_id, property, value) VALUES (?, ?, ?)", "iss", $_SESSION['person_id'], $prop, $val);
         }
         DBfunctions::getInstance()->doSingleCall("UPDATE t_persons SET submitted_at=NOW() WHERE id=?", "i", $_SESSION['person_id']);
         $form->resetToken();
         header("Location: " . APP_BASE_URL . "ende");
     } else {
         $form->addReloadLock();
         $form->assignToSmarty($tmvc->smarty);
         $tmvc->smarty->assign('content', $this->questionCollection->buildOutput($tmvc->smarty));
         $tmvc->smarty->display();
     }
 }