/**
  * Define event handlers
  *
  * @param EventsManager $events
  * @return null
  */
 function defineHandlers(&$events)
 {
     $events->listen('on_get_project_object_types', 'on_get_project_object_types');
     $events->listen('on_project_tabs', 'on_project_tabs');
     $events->listen('on_quick_add', 'on_quick_add');
     $events->listen('on_build_menu', 'on_build_menu');
     $events->listen('on_project_export', 'on_project_export');
     $events->listen('on_user_cleanup', 'on_user_cleanup');
     $events->listen('on_project_permissions', 'on_project_permissions');
     $events->listen('on_system_permissions', 'on_system_permissions');
 }
 /**
  * Define event handlers
  *
  * @param EventsManager $events
  * @return null
  */
 function defineHandlers(&$events)
 {
     $events->listen(array('on_get_project_object_types', 'on_get_completable_project_object_types', 'on_get_day_project_object_types'), 'register_milestone_type');
     $events->listen('on_project_tabs', 'on_project_tabs');
     $events->listen('on_project_object_options', 'on_project_object_options');
     $events->listen('on_project_object_quick_options', 'on_project_object_quick_options');
     $events->listen('on_quick_add', 'on_quick_add');
     $events->listen('on_project_export', 'on_project_export');
     $events->listen('on_project_permissions', 'on_project_permissions');
     $events->listen('on_portal_permissions', 'on_portal_permissions');
 }
 /**
  * Define event handlers
  *
  * @param EventsManager $events
  * @return null
  */
 function defineHandlers(&$events)
 {
     $events->listen('on_admin_sections', 'on_admin_sections');
     $events->listen('on_daily', 'on_daily');
     $events->listen('on_frequently', 'on_frequently');
     $events->listen('on_build_menu', 'on_build_menu');
     $events->listen('on_system_permissions', 'on_system_permissions');
     $events->listen('on_prepare_email', 'on_prepare_email');
     $events->listen('on_object_deleted', 'on_object_deleted');
 }
 /**
  * Define handlers
  */
 function defineHandlers()
 {
     EventsManager::listen('on_inline_tabs', 'on_inline_tabs');
     EventsManager::listen('on_admin_panel', 'on_admin_panel');
     EventsManager::listen('on_object_options', 'on_object_options');
     //EventsManager::listen('on_frequently', 'on_frequently');
     //EventsManager::listen('on_hourly', 'on_hourly');
     //EventsManager::listen('on_daily', 'on_daily');
 }
Exemplo n.º 5
0
/**
 * Trigger specific event with a given parameters
 * 
 * $result is start value of result. It determines how data returned from 
 * callback functions will be handled. If $result is:
 * 
 * - array - values will be added as new elements
 * - integer or float - values will be added to the $result
 * - string - values will be appended to current value
 * - null - values returned from callback functions are ignored
 * 
 * If callback function returns FALSE executen is stopped and result made to 
 * that point is retuned
 * 
 * WARNING: $result is not passed by reference
 *
 * @param string $event
 * @param array $params
 * @param mixed $result
 * @return mixed
 */
function event_trigger($event, $params = array(), $result = null)
{
    static $instance = false;
    if ($instance === false) {
        $instance =& EventsManager::instance();
    }
    // if
    return $instance->trigger($event, $params, $result);
}
 function defineHandlers()
 {
     // 		EventsManager::listen('on_homescreen_widget_types', 'on_homescreen_widget_types');
     EventsManager::listen('on_reports_panel', 'on_reports_panel');
     EventsManager::listen('on_project_overview_sidebars', 'on_project_overview_sidebars');
     EventsManager::listen('on_before_object_validation', 'on_before_object_validation');
     EventsManager::listen('on_after_object_save', 'on_after_object_save');
     EventsManager::listen('on_object_inspector', 'on_object_inspector');
 }
 /**
  * Define event handlers
  */
 function defineHandlers()
 {
     /*
          EventsManager::listen('on_project_created', 'on_project_created');
          EventsManager::listen('on_project_deleted', 'on_project_deleted');
     */
     EventsManager::listen('on_object_inserted', 'on_object_inserted');
     EventsManager::listen('on_object_updated', 'on_object_updated');
     EventsManager::listen('on_object_deleted', 'on_object_deleted');
     EventsManager::listen('on_object_opened', 'on_object_opened');
     EventsManager::listen('on_object_completed', 'on_object_completed');
 }
 /**
  * Prepare controller
  */
 function __before()
 {
     parent::__before();
     $this->wireframe->tabs->clear();
     $this->wireframe->tabs->add('calendar', lang('Timer'), TimerModule::getTimerRoute(), null, true);
     // Custom event
     EventsManager::trigger('on_timer_tabs', array(&$this->wireframe->tabs, &$this->logged_user));
     // set wireframe
     $this->wireframe->breadcrumbs->add('timer', lang('Timer'), TimerModule::getTimerRoute());
     $this->wireframe->setCurrentMenuItem('timer');
     $this->wireframe->actions->clear();
     // assign template variable
     $this->smarty->assign('api_url', ROOT_URL . '/api.php?format=json&auth_api_token=1-HQVcG1x3xfSNIMypMkDsAVT8W670QwGwhI387Tta');
     $this->smarty->assign('user_id', ROOT_URL . '1');
 }
Exemplo n.º 9
0
 function initQuery($params)
 {
     $tables = EventsManager::getTables();
     $tbl_events = $tables['events_manager']['columns'];
     $event_name = $params['event_name'];
     $handler_class = $params['handler_class'];
     $handler_method = $params['handler_method'];
     $this->addSelectField($tbl_events['event_id'], 'event_id');
     $this->addSelectField($tbl_events['handler_class'], 'handler_class');
     $this->addSelectField($tbl_events['handler_method'], 'handler_method');
     $this->addSelectField($tbl_events['handler_include_path'], 'handler_include_path');
     $this->addSelectField($tbl_events['event_name'], 'event_name');
     $this->WhereValue($tbl_events['event_name'], DB_EQ, $event_name);
     if ($handler_class != null) {
         $this->WhereAND();
         $this->WhereValue($tbl_events['handler_class'], DB_EQ, $handler_class);
     }
     if ($handler_method != null) {
         $this->WhereAND();
         $this->WhereValue($tbl_events['handler_method'], DB_EQ, $handler_method);
     }
     $this->SelectOrder($tbl_events['handler_order']);
 }
 function defineHandlers()
 {
     EventsManager::listen('on_milestone_sections', 'on_milestone_sections');
 }
 /**
  * Define event handlers
  *
  * @param EventsManager $events
  * @return null
  */
 function defineHandlers(&$events)
 {
     $events->listen('on_shutdown', 'on_shutdown');
     $events->listen(array('on_object_inserted', 'on_object_deleted', 'on_project_object_opened', 'on_project_object_completed', 'on_project_object_trashed', 'on_project_object_restored'), 'project_task_status');
     $events->listen('on_before_object_insert', 'on_before_object_insert');
     $events->listen('on_before_object_update', 'on_before_object_update');
     $events->listen('on_project_object_ready', 'on_project_object_ready');
     $events->listen('on_project_object_completed', 'on_project_object_completed');
     $events->listen('on_project_object_quick_options', 'on_project_object_quick_options');
     $events->listen('on_project_object_opened', 'on_project_object_opened');
     $events->listen('on_project_export', 'on_project_export');
     $events->listen('on_project_overview_sidebars', 'on_project_overview_sidebars');
     $events->listen('on_user_cleanup', 'on_user_cleanup');
     $events->listen('on_build_menu', 'on_build_menu');
     $events->listen('on_settings_sections', 'on_settings_sections');
     $events->listen('on_admin_sections', 'on_admin_sections');
     $events->listen('on_email_templates', 'on_email_templates');
     $events->listen('on_daily', 'on_daily');
     $events->listen('on_hourly', 'on_hourly');
     $events->listen('on_system_permissions', 'on_system_permissions');
     $events->listen('on_dashboard_sections', 'on_dashboard_sections');
 }
 /**
  * Define event handlers
  *
  * @param EventsManager $events
  * @return null
  */
 function defineHandlers(&$events)
 {
     //$events->listen('on_project_options', 'on_project_options');
     $events->listen('on_project_tabs', 'on_project_tabs');
 }
 /**
  * Define event handlers
  *
  * @param EventsManager $events
  * @return null
  */
 function defineHandlers(&$events)
 {
     $events->listen('on_get_project_object_types', 'on_get_project_object_types');
     $events->listen('on_project_tabs', 'on_project_tabs');
     $events->listen('on_new_revision', 'on_new_revision');
     $events->listen('on_email_templates', 'on_email_templates');
     $events->listen('on_milestone_objects', 'on_milestone_objects');
     $events->listen('on_milestone_objects_by_visibility', 'on_milestone_objects_by_visibility');
     $events->listen('on_project_object_ready', 'on_project_object_ready');
     $events->listen('on_quick_add', 'on_quick_add');
     $events->listen('on_milestone_add_links', 'on_milestone_add_links');
     $events->listen('on_project_export', 'on_project_export');
     $events->listen('on_project_permissions', 'on_project_permissions');
     $events->listen('on_master_categories', 'on_master_categories');
     $events->listen('on_project_object_options', 'on_project_object_options');
     $events->listen('on_project_object_quick_options', 'on_project_object_quick_options');
 }
Exemplo n.º 14
0
<?php

use Phalcon\Logger, Phalcon\Db\Adapter\Pdo\Mysql as Connection, Phalcon\Events\Manager, Phalcon\Logger\Adapter\File;
$di->set('db', function () {
    $eventsManager = new EventsManager();
    $logger = new Logger("app/logs/debug.log");
    //Listen all the database events
    $eventsManager->attach('db', function ($event, $connection) use($logger) {
        if ($event->getType() == 'beforeQuery') {
            $logger->log($connection->getSQLStatement(), Logger::INFO);
        }
    });
    $connection = new Connection(array("host" => "localhost", "username" => "root", "password" => "secret", "dbname" => "invo"));
    //Assign the eventsManager to the db adapter instance
    $connection->setEventsManager($eventsManager);
    return $connection;
});
 /**
  * Define event handlers
  *
  * @param EventsManager $events
  * @return null
  */
 function defineHandlers(&$events)
 {
     $events->listen('on_project_tabs', 'on_project_tabs');
     $events->listen('on_project_permissions', 'on_project_permissions');
     $events->listen('on_portal_permissions', 'on_portal_permissions');
     $events->listen('on_project_object_options', 'on_project_object_options');
     $events->listen('on_project_object_quick_options', 'on_project_object_quick_options');
     $events->listen('on_portal_object_quick_options', 'on_portal_object_quick_options');
     $events->listen('on_get_project_object_types', 'on_get_project_object_types');
     $events->listen('on_hourly', 'on_hourly');
     $events->listen('on_daily', 'on_daily');
     $events->listen('on_frequently', 'on_frequently');
     $events->listen('on_admin_sections', 'on_admin_sections');
     $events->listen('on_object_deleted', 'on_object_deleted');
 }
 function defineHandlers()
 {
     EventsManager::listen('on_project_tabs', 'on_project_tabs');
     EventsManager::listen('on_available_project_tabs', 'on_available_project_tabs');
 }
 /**
  * Define event handlers
  *
  * @param EventsManager $events
  * @return null
  */
 function defineHandlers(&$events)
 {
     $events->listen('on_build_menu', 'on_build_menu');
     $events->listen('on_project_tabs', 'on_project_tabs');
     $events->listen('on_user_options', 'on_user_options');
 }
 /**
  * Define event handlers
  */
 function defineHandlers()
 {
     EventsManager::listen('on_admin_panel', 'on_admin_panel');
 }
 /**
  * Construct Angie application instance
  *
  * @param void
  * @return AngieApplication
  */
 function __construct()
 {
     $this->router =& Router::instance();
     $this->events_manager =& EventsManager::instance();
     $this->smarty =& Smarty::instance();
 }
 /**
  * Define event handlers
  *
  * @param EventsManager $events
  * @return null
  */
 function defineHandlers(&$events)
 {
     $events->listen('on_admin_sections', 'on_admin_sections');
     $events->listen('on_daily', 'on_daily');
 }
Exemplo n.º 21
0
 /**
  * Init database.
  *
  * @param DI            $di            Dependency Injection.
  * @param Config        $config        Config object.
  * @param EventsManager $eventsManager Event manager.
  *
  * @return Pdo
  */
 protected function _initDb($di, $config, $eventsManager)
 {
     $adapter = '\\Phalcon\\Db\\Adapter\\Pdo\\' . $config->db->mysql->adapter;
     /** @var Pdo $connection */
     $connection = new $adapter(['host' => $config->db->mysql->host, 'port' => $config->db->mysql->port, 'username' => $config->db->mysql->username, 'password' => $config->db->mysql->password, 'dbname' => $config->db->mysql->dbname]);
     $isProfiler = $config->global->profiler;
     if ($isProfiler) {
         // Attach logger & profiler.
         $profiler = null;
         if ($isProfiler) {
             $profiler = new PhDbProfiler();
         }
         $eventsManager->attach('db', function ($event, $connection) use($profiler) {
             if ($event->getType() == 'beforeQuery') {
                 $statement = $connection->getSQLStatement();
                 if ($profiler) {
                     $profiler->startProfile($statement);
                 }
             }
             if ($event->getType() == 'afterQuery') {
                 // Stop the active profile.
                 if ($profiler) {
                     $profiler->stopProfile();
                 }
             }
         });
         if ($profiler && $di->has('profiler')) {
             $di->get('profiler')->setDbProfiler($profiler);
         }
         $connection->setEventsManager($eventsManager);
     }
     $di->set('db', $connection);
     /**
      * Add db service connect to five.vn database
      */
     $di->set('dbfive', function () use($config) {
         $fiveAdapter = '\\Phalcon\\Db\\Adapter\\Pdo\\' . $config->db->dbfive->adapter;
         return new $fiveAdapter(['host' => $config->db->dbfive->host, 'port' => $config->db->dbfive->port, 'username' => $config->db->dbfive->username, 'password' => $config->db->dbfive->password, 'dbname' => $config->db->dbfive->dbname]);
     });
     $di->set('modelsManager', function () use($config, $eventsManager) {
         $modelsManager = new PhModelsManager();
         $modelsManager->setEventsManager($eventsManager);
         // Attach a listener to models-manager
         $eventsManager->attach('modelsManager', new ModelAnnotationsInitializer());
         return $modelsManager;
     }, true);
     /**
      * If the configuration specify the use of metadata adapter use it or use memory otherwise.
      */
     $di->set('modelsMetadata', function () use($config) {
         if (ENV == ENV_PRODUCTION && isset($config->global->metadata)) {
             $metaDataConfig = $config->global->metadata;
             $metadataAdapter = '\\Phalcon\\Mvc\\Model\\Metadata\\' . $metaDataConfig->adapter;
             $metaData = new $metadataAdapter($config->global->metadata->toArray());
         } else {
             $metaData = new \Phalcon\Mvc\Model\MetaData\Memory();
         }
         $metaData->setStrategy(new PhStrategyAnnotations());
         return $metaData;
     }, true);
     return $connection;
 }
 /**
  * Define event handlers
  */
 function defineHandlers()
 {
     EventsManager::listen('on_main_menu', 'on_main_menu');
     EventsManager::listen('on_phone_homescreen', 'on_phone_homescreen');
 }
Exemplo n.º 23
0
 /**
  * Compiles a class/interface
  *
  * @param CompilationContext $compilationContext
  * @throws CompilerException
  */
 public function compile(CompilationContext $compilationContext)
 {
     /**
      * Sets the current object as global class definition
      */
     $compilationContext->classDefinition = $this;
     /**
      * Get the global codePrinter
      */
     $codePrinter = $compilationContext->codePrinter;
     /**
      * The ZEPHIR_INIT_CLASS defines properties and constants exported by the class
      */
     $codePrinter->output('ZEPHIR_INIT_CLASS(' . $this->getCNamespace() . '_' . $this->getName() . ') {');
     $codePrinter->outputBlankLine();
     $codePrinter->increaseLevel();
     /**
      * Method entry
      */
     $methods =& $this->methods;
     if (count($methods)) {
         $methodEntry = strtolower($this->getCNamespace()) . '_' . strtolower($this->getName()) . '_method_entry';
     } else {
         $methodEntry = 'NULL';
     }
     $namespace = str_replace('\\', '_', $compilationContext->config->get('namespace'));
     $abstractFlag = '0';
     if ($this->isAbstract()) {
         $abstractFlag = 'ZEND_ACC_EXPLICIT_ABSTRACT_CLASS';
     }
     /**
      * Register the class with extends + interfaces
      */
     $classExtendsDefinition = null;
     if ($this->extendsClass) {
         $classExtendsDefinition = $this->extendsClassDefinition;
         if (!$classExtendsDefinition->isInternal()) {
             $classEntry = $classExtendsDefinition->getClassEntry();
         } else {
             $classEntry = $this->getClassEntryByClassName($classExtendsDefinition->getName(), $compilationContext);
         }
         if ($this->getType() == 'class') {
             $codePrinter->output('ZEPHIR_REGISTER_CLASS_EX(' . $this->getNCNamespace() . ', ' . $this->getName() . ', ' . $namespace . ', ' . strtolower($this->getSCName($namespace)) . ', ' . $classEntry . ', ' . $methodEntry . ', ' . $abstractFlag . ');');
             $codePrinter->outputBlankLine();
         } else {
             $codePrinter->output('ZEPHIR_REGISTER_INTERFACE_EX(' . $this->getNCNamespace() . ', ' . $this->getName() . ', ' . $namespace . ', ' . strtolower($this->getSCName($namespace)) . ', ' . $classEntry . ', ' . $methodEntry . ');');
             $codePrinter->outputBlankLine();
         }
     } else {
         if ($this->getType() == 'class') {
             $codePrinter->output('ZEPHIR_REGISTER_CLASS(' . $this->getNCNamespace() . ', ' . $this->getName() . ', ' . $namespace . ', ' . strtolower($this->getSCName($namespace)) . ', ' . $methodEntry . ', ' . $abstractFlag . ');');
         } else {
             $codePrinter->output('ZEPHIR_REGISTER_INTERFACE(' . $this->getNCNamespace() . ', ' . $this->getName() . ', ' . $namespace . ', ' . strtolower($this->getSCName($namespace)) . ', ' . $methodEntry . ');');
         }
         $codePrinter->outputBlankLine();
     }
     $needBreak = true;
     /**
      * @todo Remove after removing support for php 5.3
      */
     $currentClassHref =& $this;
     $this->eventsManager->listen('setMethod', function (ClassMethod $method) use(&$methods, &$currentClassHref, $compilationContext, &$needBreak) {
         $needBreak = false;
         $methods[$method->getName()] = $method;
         $compilationContext->classDefinition->setMethods($methods);
     });
     /**
      * Compile properties
      * @var $property ClassProperty
      */
     foreach ($this->getProperties() as $property) {
         $docBlock = $property->getDocBlock();
         if ($docBlock) {
             $codePrinter->outputDocBlock($docBlock, true);
         }
         $property->compile($compilationContext);
         $codePrinter->outputBlankLine();
     }
     if (!$needBreak) {
         $compilationContext->codePrinter->clear();
         $currentClassHref->compile($compilationContext);
         return;
     }
     /**
      * Compile constants
      * @var $constant ClassConstant
      */
     foreach ($this->getConstants() as $constant) {
         $docBlock = $constant->getDocBlock();
         if ($docBlock) {
             $codePrinter->outputDocBlock($docBlock, true);
         }
         $constant->compile($compilationContext);
         $codePrinter->outputBlankLine();
     }
     /**
      * Implemented interfaces
      */
     $interfaces = $this->interfaces;
     $compiler = $compilationContext->compiler;
     if (is_array($interfaces)) {
         $codePrinter->outputBlankLine(true);
         foreach ($interfaces as $interface) {
             /**
              * Try to find the interface
              */
             $classEntry = false;
             if ($compiler->isInterface($interface)) {
                 $classInterfaceDefinition = $compiler->getClassDefinition($interface);
                 $classEntry = $classInterfaceDefinition->getClassEntry();
             } else {
                 if ($compiler->isInternalInterface($interface)) {
                     $classInterfaceDefinition = $compiler->getInternalClassDefinition($interface);
                     $classEntry = $this->getClassEntryByClassName($classInterfaceDefinition->getName(), $compilationContext);
                 }
             }
             if (!$classEntry) {
                 if ($compiler->isClass($interface)) {
                     throw new CompilerException("Cannot locate interface " . $interface . " when implementing interfaces on " . $this->getCompleteName() . '. ' . $interface . ' is currently a class', $this->originalNode);
                 } else {
                     throw new CompilerException("Cannot locate interface " . $interface . " when implementing interfaces on " . $this->getCompleteName(), $this->originalNode);
                 }
             }
             /**
              * We don't check if abstract classes implement the methods in their interfaces
              */
             if (!$this->isAbstract()) {
                 $this->checkInterfaceImplements($this, $classInterfaceDefinition);
             }
             $codePrinter->output('zend_class_implements(' . $this->getClassEntry() . ' TSRMLS_CC, 1, ' . $classEntry . ');');
         }
     }
     if (!$this->isAbstract()) {
         /**
          * Interfaces in extended classes may have
          */
         if ($classExtendsDefinition) {
             if (!$classExtendsDefinition->isInternal()) {
                 $interfaces = $classExtendsDefinition->getImplementedInterfaces();
                 if (is_array($interfaces)) {
                     foreach ($interfaces as $interface) {
                         $classInterfaceDefinition = null;
                         if ($compiler->isInterface($interface)) {
                             $classInterfaceDefinition = $compiler->getClassDefinition($interface);
                         } else {
                             if ($compiler->isInternalInterface($interface)) {
                                 $classInterfaceDefinition = $compiler->getInternalClassDefinition($interface);
                             }
                         }
                         if ($classInterfaceDefinition) {
                             $this->checkInterfaceImplements($this, $classInterfaceDefinition);
                         }
                     }
                 }
             }
         }
     }
     $codePrinter->output('return SUCCESS;');
     $codePrinter->outputBlankLine();
     $codePrinter->decreaseLevel();
     $codePrinter->output('}');
     $codePrinter->outputBlankLine();
     /**
      * Compile methods
      */
     foreach ($methods as $method) {
         $docBlock = $method->getDocBlock();
         if ($docBlock) {
             $codePrinter->outputDocBlock($docBlock);
         }
         if ($this->getType() == 'class') {
             $codePrinter->output('PHP_METHOD(' . $this->getCNamespace() . '_' . $this->getName() . ', ' . $method->getName() . ') {');
             $codePrinter->outputBlankLine();
             if (!$method->isAbstract()) {
                 $method->compile($compilationContext);
             }
             $codePrinter->output('}');
             $codePrinter->outputBlankLine();
         } else {
             $codePrinter->output('ZEPHIR_DOC_METHOD(' . $this->getCNamespace() . '_' . $this->getName() . ', ' . $method->getName() . ');');
             $codePrinter->outputBlankLine();
         }
     }
     /**
      * Create a code printer for the header file
      */
     $codePrinter = new CodePrinter();
     $codePrinter->outputBlankLine();
     $codePrinter->output('extern zend_class_entry *' . $this->getClassEntry() . ';');
     $codePrinter->outputBlankLine();
     $codePrinter->output('ZEPHIR_INIT_CLASS(' . $this->getCNamespace() . '_' . $this->getName() . ');');
     $codePrinter->outputBlankLine();
     if ($this->getType() == 'class') {
         if (count($methods)) {
             foreach ($methods as $method) {
                 $codePrinter->output('PHP_METHOD(' . $this->getCNamespace() . '_' . $this->getName() . ', ' . $method->getName() . ');');
             }
             $codePrinter->outputBlankLine();
         }
     }
     /**
      * Create argument info
      */
     foreach ($methods as $method) {
         $parameters = $method->getParameters();
         if (count($parameters)) {
             $codePrinter->output('ZEND_BEGIN_ARG_INFO_EX(arginfo_' . strtolower($this->getCNamespace() . '_' . $this->getName() . '_' . $method->getName()) . ', 0, 0, ' . $method->getNumberOfRequiredParameters() . ')');
             foreach ($parameters->getParameters() as $parameter) {
                 switch ($parameter['data-type']) {
                     case 'array':
                         $codePrinter->output("\t" . 'ZEND_ARG_ARRAY_INFO(0, ' . $parameter['name'] . ', ' . (isset($parameter['default']) ? 1 : 0) . ')');
                         break;
                     case 'variable':
                         if (isset($parameter['cast'])) {
                             switch ($parameter['cast']['type']) {
                                 case 'variable':
                                     $value = $parameter['cast']['value'];
                                     $codePrinter->output("\t" . 'ZEND_ARG_OBJ_INFO(0, ' . $parameter['name'] . ', ' . Utils::escapeClassName($compilationContext->getFullName($value)) . ', ' . (isset($parameter['default']) ? 1 : 0) . ')');
                                     break;
                                 default:
                                     throw new Exception('Unexpected exception');
                             }
                         } else {
                             $codePrinter->output("\t" . 'ZEND_ARG_INFO(0, ' . $parameter['name'] . ')');
                         }
                         break;
                     default:
                         $codePrinter->output("\t" . 'ZEND_ARG_INFO(0, ' . $parameter['name'] . ')');
                         break;
                 }
             }
             $codePrinter->output('ZEND_END_ARG_INFO()');
             $codePrinter->outputBlankLine();
         }
     }
     if (count($methods)) {
         $codePrinter->output('ZEPHIR_INIT_FUNCS(' . strtolower($this->getCNamespace() . '_' . $this->getName()) . '_method_entry) {');
         foreach ($methods as $method) {
             $parameters = $method->getParameters();
             if ($this->getType() == 'class') {
                 if (count($parameters)) {
                     $codePrinter->output("\t" . 'PHP_ME(' . $this->getCNamespace() . '_' . $this->getName() . ', ' . $method->getName() . ', arginfo_' . strtolower($this->getCNamespace() . '_' . $this->getName() . '_' . $method->getName()) . ', ' . $method->getModifiers() . ')');
                 } else {
                     $codePrinter->output("\t" . 'PHP_ME(' . $this->getCNamespace() . '_' . $this->getName() . ', ' . $method->getName() . ', NULL, ' . $method->getModifiers() . ')');
                 }
             } else {
                 if ($method->isStatic()) {
                     if (count($parameters)) {
                         $codePrinter->output("\t" . 'ZEND_FENTRY(' . $method->getName() . ', NULL, arginfo_' . strtolower($this->getCNamespace() . '_' . $this->getName() . '_' . $method->getName()) . ', ZEND_ACC_STATIC|ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC)');
                     } else {
                         $codePrinter->output("\t" . 'ZEND_FENTRY(' . $method->getName() . ', NULL, NULL, ZEND_ACC_STATIC|ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC)');
                     }
                 } else {
                     if (count($parameters)) {
                         $codePrinter->output("\t" . 'PHP_ABSTRACT_ME(' . $this->getCNamespace() . '_' . $this->getName() . ', ' . $method->getName() . ', arginfo_' . strtolower($this->getCNamespace() . '_' . $this->getName() . '_' . $method->getName()) . ')');
                     } else {
                         $codePrinter->output("\t" . 'PHP_ABSTRACT_ME(' . $this->getCNamespace() . '_' . $this->getName() . ', ' . $method->getName() . ', NULL)');
                     }
                 }
             }
         }
         $codePrinter->output('  PHP_FE_END');
         $codePrinter->output('};');
     }
     $compilationContext->headerPrinter = $codePrinter;
 }
 /**
  * Define event handlers
  *
  * @param EventsManager $events
  * @return null
  */
 function defineHandlers(&$events)
 {
     $events->listen('on_get_project_object_types', 'on_get_project_object_types');
     $events->listen('on_get_completable_project_object_types', 'on_get_completable_project_object_types');
     $events->listen('on_email_templates', 'on_email_templates');
     $events->listen('on_comment_added', 'on_comment_added');
     $events->listen('on_comment_deleted', 'on_comment_deleted');
     $events->listen('on_project_object_copied', 'on_project_object_copied');
     $events->listen('on_project_object_moved', 'on_project_object_moved');
     $events->listen('on_project_object_reassigned', 'on_project_object_reassigned');
     $events->listen('on_project_user_removed', 'on_project_user_removed');
     $events->listen('on_object_deleted', 'on_object_deleted');
     $events->listen('on_system_permissions', 'on_system_permissions');
     $events->listen('on_dashboard_important_section', 'on_dashboard_important_section');
 }
 /**
  * Define event handlers
  *
  * @param EventsManager $events
  * @return null
  */
 function defineHandlers(&$events)
 {
     $events->listen('on_build_menu', 'on_build_menu');
     $events->listen('on_system_permissions', 'on_system_permissions');
 }
Exemplo n.º 26
0
define('EVENT_REPLACE', 0);
define('EVENT_PRE', -1);
/**
 *  Constants to define scope of the includes
 */
define('INCLUDE_NO_GLOBALS', 0);
// include with local scope without global vars, all globals must be declared explicitly (recommended for development)
define('INCLUDE_R_GLOBALS', 1);
// include with extract($GLOBALS) - all global values are available in local scope
define('INCLUDE_RW_GLOBALS', 2);
// include with declared all global vars (default)
global $app_main_dir, $eventsManager, $includesManager;
require_once $app_main_dir . '/include/lib/events/EventsManager.class.php';
require_once $app_main_dir . '/include/lib/events/EventReturn.class.php';
require_once $app_main_dir . '/include/lib/events/IncludesManager.class.php';
$eventsManager =& EventsManager::instance();
$includesManager =& IncludesManager::instance();
/** EVENTS MECHANISM **/
/**
 * Subscribe $callback to an $event
 *
 * $events can be an array of events or single even name
 *
 * @param array $events
 * @param string $callback
 * @param integer $type
 * @return null
 */
function cw_event_listen($event, $callback, $type = EVENT_POST)
{
    global $eventsManager;
 function uninstall()
 {
     $query = new DB_Table_Delete(EventsManager::getTables());
     global $application;
     $application->db->getDB_Result($query);
 }
 /**
  * Define event handlers
  *
  * @param EventsManager $events
  * @return null
  */
 function defineHandlers(&$events)
 {
     $events->listen('on_get_project_object_types', 'on_get_project_object_types');
     $events->listen('on_project_tabs', 'on_project_tabs');
     $events->listen('on_milestone_objects', 'on_milestone_objects');
     $events->listen('on_milestone_objects_by_visibility', 'on_milestone_objects_by_visibility');
     $events->listen('on_project_object_opened', 'on_project_object_opened');
     $events->listen('on_project_object_completed', 'on_project_object_completed');
     $events->listen('on_object_inserted', 'on_object_inserted');
     $events->listen('on_project_object_trashed', 'on_project_object_trashed');
     $events->listen('on_project_object_restored', 'on_project_object_restored');
     $events->listen('on_quick_add', 'on_quick_add');
     $events->listen('on_milestone_add_links', 'on_milestone_add_links');
     $events->listen('on_project_export', 'on_project_export');
     $events->listen('on_copy_project_items', 'on_copy_project_items');
     $events->listen('on_project_permissions', 'on_project_permissions');
     $events->listen('on_get_completable_project_object_types', 'on_get_completable_project_object_types');
 }
 /**
  * Define event handlers
  *
  * @param EventsManager $events
  * @return null
  */
 function defineHandlers(&$events)
 {
     $events->listen('on_admin_sections', 'on_admin_sections');
     $events->listen('on_build_menu', 'on_build_menu');
     $events->listen('on_system_permissions', 'on_system_permissions');
     $events->listen('on_company_options', 'on_company_options');
     $events->listen('on_user_cleanup', 'on_user_cleanup');
     $events->listen('on_time_report_footer_options', 'on_time_report_footer_options');
     $events->listen('on_object_deleted', 'on_object_deleted');
     $events->listen('on_company_tabs', 'on_company_tabs');
     $events->listen('on_project_object_quick_options', 'on_project_object_quick_options');
     $events->listen('on_dashboard_important_section', 'on_dashboard_important_section');
 }
 function defineHandlers()
 {
     EventsManager::listen('on_object_inspector', 'on_object_inspector');
 }