예제 #1
0
function obj_reload($id)
{
    $textinp = new editor_text();
    $checkbox = new editor_checkbox();
    $dropdown = new editor_dropdown();
    $textarea = new editor_textarea();
    switch ($id) {
        case 'tt':
            return $textinp->into_div('tt', $_SESSION['tt']);
        case 'tt1':
            return $textinp->into_div('tt1', $_SESSION['tt1']);
        case 'tt4':
            return $checkbox->into_div('tt4', $_SESSION['tt4']);
        case 'tt5':
            $dropdown->options = array("1" => 'option 1', "2" => 'option2', "3" => 'option3', "4" => 'option24');
            return print $dropdown->into_div('tt5', $_SESSION['tt5']);
        case 'tt8':
            return $textarea->into_div('tt8', $_SESSION['tt8']);
    }
    return '';
}
예제 #2
0
 function handle_event($ev)
 {
     $db = $ev->context[$ev->long_name]['dbname'];
     $tbl = $ev->context[$ev->long_name]['tblname'];
     $col = $ev->context[$ev->long_name]['colname'];
     if (isset($ev->context[$ev->long_name]['validator_class'])) {
         if (class_exists($ev->context[$ev->long_name]['validator_class'])) {
             $validator = new $ev->context[$ev->long_name]['validator_class']();
             if (method_exists($validator, 'validate')) {
                 $validator->context =& $ev->context;
                 $validator->long_name = $ev->long_name;
                 $validator->keys =& $ev->keys;
                 $validator->oid =& $ev->context[$ev->long_name]['oid'];
                 if (!$validator->validate($_POST['val'])) {
                     $ev->failure = $validator->failure;
                     parent::handle_event($ev);
                     return;
                 }
             } else {
                 $ev->failure = 'Не обнаружен класс валидатора: ' . $ev->context[$ev->long_name]['validator_class'] . ' свяжитесь с разработчиком.';
                 parent::handle_event($ev);
                 return;
             }
         } else {
             $ev->failure = 'Не обнаружен класс валидатора: ' . $ev->context[$ev->long_name]['validator_class'] . ' свяжитесь с разработчиком.';
             parent::handle_event($ev);
             return;
         }
     }
     $this->store_sql($ev);
     parent::handle_event($ev);
 }