/**
  * Saves admin options.
  * This is called through a hook
  *
  * @author Panagiotis Vagenas <*****@*****.**>
  * @since 1.0.0
  */
 public function saveOptions()
 {
     if (!current_user_can('manage_options')) {
         wp_die('Not allowed');
     }
     erpPROPaths::requireOnce(erpPROPaths::$erpPROMainOpts);
     // Save template options
     if (isset($_POST['dsplLayout'])) {
         erpPROPaths::requireOnce(erpPROPaths::$VPluginThemeFactory);
         VPluginThemeFactory::registerThemeInPathRecursive(erpPROPaths::getAbsPath(erpPROPaths::$mainThemesFolder), $_POST['dsplLayout']);
         $theme = VPluginThemeFactory::getThemeByName($_POST['dsplLayout']);
         if ($theme) {
             $theme->saveSettings($_POST);
             foreach ($theme->getDefOptions() as $key => $value) {
                 unset($_POST[$key]);
             }
         } else {
             // TODO Add notice class
             //                $message = new WP_Error_Notice('Theme '.$_POST ['dsplLayout'].' not found. Theme options discarded', 1, array('settings_page_erp_settings'));
             //                WP_Admin_Notices::getInstance()->addNotice($message);
         }
     }
     // Save the rest of the options
     $mainOptionsObj = new erpPROMainOpts();
     $mainOptionsObj->saveOptions($_POST);
     wp_redirect(add_query_arg(array('page' => $this->plugin_slug . '_settings', 'tab-spec' => wp_strip_all_tags($_POST['tab-spec'])), admin_url('options-general.php')));
     exit;
 }