Ejemplo n.º 1
0
             $glossary_data['insert_date'] = '';
         }
         if (!empty($glossary_data['update_date']) && $glossary_data['update_date'] != '0000-00-00 00:00:00:') {
             $glossary_data['update_date'] = api_get_local_time($glossary_data['update_date']);
         } else {
             $glossary_data['update_date'] = '';
         }
         $form->setDefaults($glossary_data);
         // setting the rules
         $form->addRule('glossary_title', get_lang('ThisFieldIsRequired'), 'required');
         // The validation or display
         if ($form->validate()) {
             $check = Security::check_token('post');
             if ($check) {
                 $values = $form->exportValues();
                 GlossaryManager::update_glossary($values);
             }
             Security::clear_token();
             GlossaryManager::display_glossary();
         } else {
             $token = Security::get_token();
             $form->addElement('hidden', 'sec_token');
             $form->setConstants(array('sec_token' => $token));
             $form->display();
         }
     }
     break;
 case 'delete_glossary':
     GlossaryManager::delete_glossary($_GET['glossary_id']);
     GlossaryManager::display_glossary();
     break;