Beispiel #1
0
 protected static function checkOptions(&$options)
 {
     if (!parent::checkOptions($options)) {
         return false;
     }
     TIP::arrayDefault($options, 'data', $options['id']);
     if (is_string($options['data'])) {
         $options['data'] =& TIP_Type::singleton(array('type' => array('data'), 'path' => $options['data']));
     } elseif (@is_array($options['data'])) {
         TIP::arrayDefault($options['data'], 'type', array('data'));
         TIP::arrayDefault($options['data'], 'path', $options['id']);
         $options['data'] =& TIP_Type::singleton($options['data']);
     }
     return $options['data'] instanceof TIP_Data;
 }
Beispiel #2
0
 /**
  * Check the options
  *
  * Overridable static method that checks $options for missing or invalid
  * values and eventually corrects its content.
  *
  * @param  array &$options Properties values
  * @return bool            true on success or false on error
  */
 protected static function checkOptions(&$options)
 {
     if (!parent::checkOptions($options) || !isset($options['engine'], $options['data_engine'])) {
         return false;
     }
     if (is_string($options['data_engine'])) {
         $options['data_engine'] =& TIP_Type::singleton(array('id' => $options['data_engine'], 'type' => array('data_engine', $options['data_engine'])));
     } elseif (is_array($options['data_engine'])) {
         $options['data_engine'] =& TIP_Type::singleton($options['data_engine']);
     }
     if (is_null($options['data_engine'])) {
         return false;
     }
     return true;
 }
Beispiel #3
0
 protected static function checkOptions(&$options)
 {
     if (!parent::checkOptions($options) || !isset($options['master'], $options['action'])) {
         return false;
     }
     // Force the current form id to the binded module id
     // (the "master" module)
     $options['id'] = $options['master']->getProperty('id');
     // Default values
     TIP::arrayDefault($options, 'locale_prefix', 'form');
     TIP::arrayDefault($options, 'action_id', $options['action']);
     isset($options['referer']) || ($options['referer'] = TIP::getRefererUri());
     isset($options['follower']) || ($options['follower'] = $options['referer']);
     isset($options['json']) || ($options['json'] = TIP_Application::getGlobal('json'));
     if (!isset($options['buttons'])) {
         switch ($options['action']) {
             case TIP_FORM_ACTION_ADD:
             case TIP_FORM_ACTION_EDIT:
                 $options['buttons'] = TIP_FORM_BUTTON_SUBMIT | TIP_FORM_BUTTON_CANCEL;
                 break;
             case TIP_FORM_ACTION_VIEW:
                 $options['buttons'] = TIP_FORM_BUTTON_CLOSE;
                 break;
             case TIP_FORM_ACTION_DELETE:
                 $options['buttons'] = TIP_FORM_BUTTON_DELETE | TIP_FORM_BUTTON_CANCEL;
                 break;
             default:
                 $options['buttons'] = TIP_FORM_BUTTON_CLOSE;
         }
     }
     return true;
 }