Пример #1
0
 /**
  * Class Constructor
  * @param $label  The menu label
  * @param $action The menu action
  * @param $image  The menu image
  */
 public function __construct($label, $action, $image = NULL)
 {
     parent::__construct($label);
     // converts into ISO
     parent::set_image(null);
     if (OS == 'WIN') {
         parent::set_border_width(3);
     }
     $this->label = $label;
     $this->action = $action;
     $this->image = $image;
     if (file_exists($image)) {
         parent::set_image(GtkImage::new_from_file($image));
     }
     $inst = AdiantiCoreApplication::getInstance();
     if ($inst instanceof AdiantiCoreApplication) {
         parent::connect_simple('activate', array($inst, 'run'), $action);
     }
 }
Пример #2
0
 /**
  * Executed when the user selects a date
  */
 public function onSelectDate()
 {
     if ($this->action instanceof TAction) {
         $date = $this->get_date();
         $day = $date[2];
         $month = $date[1] + 1;
         $year = $date[0];
         $callb = $this->action->getAction();
         $parameters = $this->action->getParameters();
         $parameters['year'] = $year;
         $parameters['month'] = $month;
         $parameters['day'] = $day;
         if (is_object($callb[0])) {
             $object = $callb[0];
             call_user_func($callb, $parameters);
         } else {
             $class = $callb[0];
             $method = $callb[1];
             AdiantiCoreApplication::executeMethod($class, $method, $parameters);
         }
     }
 }
Пример #3
0
 /**
  * Execute the action
  * @param  $action callback to be executed
  * @ignore-autocomplete on
  */
 public function onExecute($action)
 {
     $callb = $action->getAction();
     if (is_object($callb[0])) {
         $object = $callb[0];
         call_user_func($callb, $action->getParameters());
         //aquip, este IF estava acima do call_user_func
         if (method_exists($object, 'show')) {
             if ($object->get_child()) {
                 $object->show();
             }
         }
     } else {
         $class = $callb[0];
         $method = $callb[1];
         AdiantiCoreApplication::executeMethod($class, $method, $action->getParameters());
     }
 }
Пример #4
0
 /**
  * Execute the action
  * @param  $action A TDataGridAction object
  * @ignore-autocomplete on
  */
 public function onExecute(TDataGridAction $action)
 {
     $selection = $this->view->get_selection();
     if ($selection) {
         list($model, $iter) = $selection->get_selected();
         if ($iter) {
             $activeObject = $this->model->get_value($iter, $this->count);
             $field = $action->getField();
             $label = $action->getLabel();
             if (is_null($field)) {
                 throw new Exception(AdiantiCoreTranslator::translate('Field for action ^1 not defined', $label) . '.<br>' . AdiantiCoreTranslator::translate('Use the ^1 method', 'setField' . '()') . '.');
             }
             $array['key'] = $activeObject->{$field};
             $callb = $action->getAction();
             if (is_array($callb)) {
                 if (is_object($callb[0])) {
                     $object = $callb[0];
                     $window_visible = method_exists($object, 'get_visible') ? $object->get_visible() : $object->is_visible();
                     // execute action
                     call_user_func($callb, $array);
                     if (method_exists($object, 'show')) {
                     }
                     // if the window wasn't visible before
                     // the operation, shows it.
                     // Forms: window wasn't visible, then show.
                     // SeekBtns: window was visible, do nothing.
                     //           the operation itself closes the window.
                     if (!$window_visible) {
                         if ($object->get_child()) {
                             $object->show();
                         }
                     }
                 } else {
                     $class = $callb[0];
                     $method = $callb[1];
                     AdiantiCoreApplication::executeMethod($class, $method, $array);
                 }
             } else {
                 // execute action
                 call_user_func($callb, $array);
             }
         }
     }
 }