コード例 #1
0
ファイル: ModuleManager.php プロジェクト: jbzdak/wikidot
 public static function instance()
 {
     if (self::$instance == null) {
         self::$instance = new ModuleManager();
     }
     return self::$instance;
 }
コード例 #2
0
 public function body()
 {
     $t = $this->pack_module('Base/Theme');
     //caption
     $box_module = ModuleManager::get_instance('/Base_Box|0');
     if ($box_module) {
         $active_module = $box_module->get_main_module();
     }
     if ($active_module && is_callable(array($active_module, 'caption'))) {
         $caption = $active_module->caption();
         if (Variable::get('show_module_indicator')) {
             $t->assign('text', $caption);
         } else {
             $t->assign('text', '');
         }
         $show_caption = Variable::get('show_caption_in_title');
         $maintenance_mode = MaintenanceMode::is_on() ? ' (Maintenance mode)' : '';
         $base_title = Variable::get('base_page_title') . $maintenance_mode;
         if ($show_caption || strlen($base_title) > 0) {
             if ($show_caption && strlen($base_title) > 0) {
                 $caption = $base_title . ' - ' . $caption;
             } elseif (strlen($base_title) > 0) {
                 $caption = $base_title;
             }
             eval_js('document.title=\'' . addslashes($caption) . '\'');
         }
     } else {
         $t->assign('text', '');
         eval_js('document.title=\'' . addslashes(Variable::get('base_page_title')) . '\'');
     }
     $t->display();
 }
コード例 #3
0
ファイル: PhotoCommon_0.php プロジェクト: cretzu89/EPESI
 public static function submit_contact($values, $mode)
 {
     if ($mode == 'display') {
         $ret = array();
         $in = self::Instance();
         $filename = self::get_photo($values['id']);
         if ($filename) {
             $file = $in->get_data_dir() . $filename;
         } else {
             $file = Base_ThemeCommon::get_template_file('CRM/Contacts/Photo', 'placeholder.png');
             $ret['photo_note'] = __('Click to change');
         }
         $ret['photo_link'] = Module::create_href(array('upload_new_photo' => $values['id'])) . ' ' . Utils_TooltipCommon::open_tag_attrs(__('Click to change the photo'), false);
         $ret['photo_src'] = $file;
     } else {
         $ret = $values;
     }
     if (isset($_REQUEST['upload_new_photo']) && $_REQUEST['upload_new_photo'] == $values['id']) {
         unset($_REQUEST['upload_new_photo']);
         $x = ModuleManager::get_instance('/Base_Box|0');
         if (!$x) {
             trigger_error('There is no base box module instance', E_USER_ERROR);
         }
         $x->push_main('CRM/Contacts/Photo', 'body', array($values));
     }
     return $ret;
 }
コード例 #4
0
ファイル: mobile.php プロジェクト: cretzu89/EPESI
function mobile_menu()
{
    $menus = ModuleManager::call_common_methods('mobile_menu');
    global $menus_out, $menus_out_tmp;
    $menus_out = array();
    foreach ($menus as $m => $r) {
        if (!is_array($r)) {
            continue;
        }
        foreach ($r as $cap => $met) {
            if (is_array($met)) {
                if (!isset($met['func'])) {
                    continue;
                }
                $method = array($m . 'Common', $met['func']);
                $args = isset($met['args']) ? $met['args'] : array();
                $weight = isset($met['weight']) ? $met['weight'] : 0;
                $color = isset($met['color']) ? $met['color'] : 'white';
            } else {
                $method = array($m . 'Common', $met);
                $args = array();
                $weight = 0;
                $color = 'white';
            }
            $menus_out[$cap] = array($method, $args, $weight, $color);
        }
    }
    $menus_out_tmp = $menus_out;
    uksort($menus_out, 'sort_menus_cmp');
    foreach ($menus_out as $cap => $met) {
        print '<a ' . mobile_stack_href($met[0], $met[1], $cap) . ' ' . (IPHONE ? ' class="button ' . $met[3] . '"' : '') . '>' . $cap . '</a>' . (IPHONE ? '' : '<br>');
    }
}
コード例 #5
0
ファイル: system_managers.php プロジェクト: tareqy/Caracal
 /**
  * Public function that creates a single instance
  */
 public static function getInstance()
 {
     if (!isset(self::$_instance)) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
コード例 #6
0
ファイル: DashboardCommon_0.php プロジェクト: 62BRAINS/EPESI
 public static function get_installed_applets_html()
 {
     $colors = Base_DashboardCommon::get_available_colors();
     $app_cap = ModuleManager::call_common_methods('applet_caption');
     asort($app_cap);
     $app_info = ModuleManager::call_common_methods('applet_info');
     $html = '';
     foreach ($app_cap as $name => $cap) {
         if (!$cap) {
             continue;
         }
         $th = Base_ThemeCommon::init_smarty();
         $id = str_replace('_', '-', $name);
         if (!isset($app_info[$name])) {
             $app_info[$name] = '';
         }
         $th->assign('content', '<div class="content" style="padding:4px;" id="dashboard_applet_content_' . $id . '">' . $app_info[$name] . '</div>');
         $th->assign('handle_class', 'handle');
         $th->assign('caption', $cap);
         $th->assign('color', $colors[0]['class']);
         $remove_button = Base_DashboardCommon::get_remove_applet_button($id, false);
         $th->assign('remove', $remove_button);
         $th->assign('__link', array('remove' => Base_ThemeCommon::parse_links('remove', $remove_button)));
         //print('<xmp>'.self::get_remove_applet_button(null, false).'</xmp><br>');
         $th->assign('actions', array());
         $th->assign('config_mode', true);
         $html .= '<div class="applet" searchkey="' . strtolower($cap ? $cap : $name) . ';' . strtolower($app_info[$name]) . '" id="ab_item_' . 'new_' . $id . '">';
         ob_start();
         Base_ThemeCommon::display_smarty($th, 'Base_Dashboard', 'default');
         $html .= ob_get_clean();
         $html .= '</div>';
     }
     return $html;
 }
コード例 #7
0
ファイル: RecordPrinter.php プロジェクト: cretzu89/EPESI
 protected function format_values($tab, $record_id)
 {
     $rb_obj = new RBO_RecordsetAccessor($tab);
     $record = $rb_obj->get_record($record_id);
     if (!$record) {
         return array();
     }
     $access = Utils_RecordBrowserCommon::get_access($tab, 'view', $record);
     if (!$access) {
         return array();
     }
     // use RB object instance for better display callback compatibility
     // some of them uses Utils_RecordBrowser::$rb_obj instance
     $rb = ModuleManager::new_instance('Utils_RecordBrowser', null, 'rb');
     $rb->construct($tab);
     $rb->init($tab);
     $fields = Utils_RecordBrowserCommon::init($tab);
     $printable_data = array();
     foreach ($fields as $f) {
         if ($access[$f['id']]) {
             $printable_data[] = array('label' => _V($f['name']), 'value' => $record->get_val($f['id'], true));
         }
     }
     // fill rows - it's easier here than in template
     if ($this->fill_empty_rows()) {
         while (count($printable_data) % $this->cols() != 0) {
             $printable_data[] = array('label' => '', 'value' => '');
         }
     }
     return $printable_data;
 }
コード例 #8
0
ファイル: common.php プロジェクト: tareqy/Caracal
/**
 * Perform database initialization.
 *
 * @param boolean $create_database
 * @return boolean
 */
function database_initialize($create_database)
{
    global $db, $db_config, $data_path;
    $result = false;
    $database_exists = false;
    $sql_file = 'units/database/init.sql';
    $xml_file = $data_path . 'system_init.xml';
    if (!file_exists($sql_file) || !file_exists($xml_file)) {
        trigger_error('Can not initialize database, missing configuration!', E_USER_ERROR);
        return $result;
    }
    // make a log entry
    trigger_error('Initializing database: ' . $db_config['name'], E_USER_NOTICE);
    // get initialization SQL
    $sql = file_get_contents($sql_file);
    // create database if needed
    if ($create_database) {
        try {
            $db->create($db_config['name']);
            $db->select($db_config['name']);
            $database_exists = true;
        } catch (Exception $error) {
            $database_exists = false;
        }
    } else {
        $database_exists = true;
    }
    // create database
    if ($database_exists && $db->multi_query($sql)) {
        $module_manager = ModuleManager::getInstance();
        $module_handler = ModuleHandler::getInstance();
        $admin_manager = UserManager::getInstance();
        // populate tables
        $raw_data = file_get_contents($xml_file);
        $data = new XMLParser($raw_data, $xml_file);
        $data->parse();
        // go over XML file and insert data
        foreach ($data->document->tagChildren as $item) {
            switch ($item->tagName) {
                case 'module':
                    // insert data
                    $module_manager->insertData(array('name' => $item->tagAttrs['name'], 'order' => $item->tagAttrs['order'], 'preload' => $item->tagAttrs['preload'] == 'yes' ? 1 : 0, 'active' => 1));
                    // initialize module
                    $module = $module_handler->_loadModule($item->tagAttrs['name']);
                    if (!is_null($module)) {
                        $module->onInit();
                    }
                    break;
                case 'user':
                    $salt = hash('sha256', UserManager::SALT . strval(time()));
                    $password = hash_hmac('sha256', $item->tagAttrs['password'], $salt);
                    $admin_manager->insertData(array('username' => $item->tagAttrs['username'], 'password' => $password, 'fullname' => $item->tagAttrs['fullname'], 'level' => $item->tagAttrs['level'], 'verified' => 1, 'salt' => $salt));
                    break;
            }
        }
        // set result
        $result = true;
    }
    return $result;
}
コード例 #9
0
ファイル: Modules.php プロジェクト: cretzu89/EPESI
 public function body()
 {
     ob_start();
     //create default module form
     print '<div class="title">Select modules to disable</div>';
     print 'Selected modules will be marked as not installed but uninstall methods will not be called. Any database tables and other modifications made by modules\' install methods will not be reverted.<br><br>';
     print 'To uninstall module please use Modules Administration in Application.';
     print '<hr/><br/>';
     $form = new HTML_QuickForm('modulesform', 'post', $_SERVER['PHP_SELF'] . '?' . http_build_query($_GET), '', null, true);
     $states = array(ModuleManager::MODULE_ENABLED => 'Active', ModuleManager::MODULE_DISABLED => 'Inactive');
     $modules = DB::GetAssoc('SELECT * FROM modules ORDER BY state, name');
     foreach ($modules as $m) {
         $name = $m['name'];
         $state = isset($m['state']) ? $m['state'] : ModuleManager::MODULE_ENABLED;
         if ($state == ModuleManager::MODULE_NOT_FOUND) {
             $state = ModuleManager::MODULE_DISABLED;
         }
         $form->addElement('select', $name, $name, $states);
         $form->setDefaults(array($name => $state));
     }
     $form->addElement('button', 'submit_button', 'Save', array('class' => 'button', 'onclick' => 'if(confirm("Are you sure?")) document.modulesform.submit();'));
     //validation or display
     if ($form->validate()) {
         //uninstall
         $vals = $form->exportValues();
         foreach ($vals as $k => $v) {
             if (isset($modules[$k]['state']) && $modules[$k]['state'] != $v) {
                 ModuleManager::set_module_state($k, $v);
             }
         }
     }
     $form->display();
     return ob_get_clean();
 }
コード例 #10
0
ファイル: CommonCommon_0.php プロジェクト: cretzu89/EPESI
 public static function user_settings()
 {
     if (Acl::is_user()) {
         $methods = array('none' => __('None'), 'callto' => __('Skype and other "callto" protocol applications')) + ModuleManager::call_common_methods('dialer_description');
         return array(__('Dialing') => array(array('name' => 'method', 'label' => __('Dialing Method'), 'type' => 'select', 'values' => $methods, 'default' => 'none')), __('Misc') => array(array('name' => 'default_record_permission', 'label' => __('Default Records Permission'), 'type' => 'select', 'default' => 0, 'values' => Utils_CommonDataCommon::get_translated_array('CRM/Access', false))));
     }
     return array();
 }
コード例 #11
0
ファイル: Event_0.php プロジェクト: cretzu89/EPESI
 public function back_to_calendar()
 {
     $x = ModuleManager::get_instance('/Base_Box|0');
     if (!$x) {
         trigger_error('There is no base box module instance', E_USER_ERROR);
     }
     $x->pop_main();
 }
コード例 #12
0
ファイル: Messenger_0.php プロジェクト: cretzu89/EPESI
 public function push_box0($func, $args, $const_args)
 {
     $x = ModuleManager::get_instance('/Base_Box|0');
     if (!$x) {
         trigger_error('There is no base box module instance', E_USER_ERROR);
     }
     $x->push_main('Utils/Messenger', $func, $args, $const_args);
 }
コード例 #13
0
ファイル: ThemeUp.php プロジェクト: cretzu89/EPESI
 public function action()
 {
     set_time_limit(0);
     Cache::clear();
     ModuleManager::create_common_cache();
     Base_ThemeCommon::themeup();
     return true;
 }
コード例 #14
0
ファイル: Filters_0.php プロジェクト: 62BRAINS/EPESI
 public function manage_filters()
 {
     $x = ModuleManager::get_instance('/Base_Box|0');
     if (!$x) {
         trigger_error('There is no base box module instance', E_USER_ERROR);
     }
     $x->push_main($this->get_type(), 'edit', array(false));
 }
コード例 #15
0
ファイル: PrintInstall.php プロジェクト: 62BRAINS/EPESI
 public function install()
 {
     Base_ThemeCommon::install_default_theme($this->get_type());
     ModuleManager::include_common($this->get_type(), 0);
     Base_PrintCommon::register_document_type(new Base_Print_Document_HTML());
     Base_PrintCommon::register_document_type(new Base_Print_Document_PDF());
     return true;
 }
コード例 #16
0
ファイル: ModuleManager.php プロジェクト: hlag/svs
  /**
   * Initialising the ModuleManger
   *
   * The ModuleManager reads the possible Modules from the ModulesDirectory
   * @return ModuleManager
   */
	public static function getInstance()
	{
		if (!isset(self::$instance))
		{
                self::$instance = new ModuleManager();
            }
        return self::$instance;
	}
コード例 #17
0
ファイル: ModuleManager.php プロジェクト: jaedb/modulemanager
 /**
  * Build positions array into dropdown key => value format for CMS fields
  * @return array
  **/
 public static function get_positions_dropdown()
 {
     $array = [];
     foreach (ModuleManager::config()->positions as $position) {
         $array[$position] = $position;
     }
     return $array;
 }
コード例 #18
0
ファイル: HCacheCommand.php プロジェクト: alefernie/intranet
 /**
  * Flushes all application cache data
  */
 public function actionFlush()
 {
     Yii::app()->cache->flush();
     ModuleManager::flushCache();
     if (Yii::app()->cache instanceof CApcCache) {
         print "Warning: Could not flush APC Cache! - Restart Webserver!\n";
     }
     print "All application caches flushed!\n";
 }
コード例 #19
0
ファイル: Callbacks_0.php プロジェクト: cretzu89/EPESI
 public function this_stack()
 {
     $x = ModuleManager::get_instance('/Base_Box|0');
     if (!$x) {
         trigger_error('There is no base box module instance', E_USER_ERROR);
     }
     $x->push_main('Tests/Callbacks', 'body');
     return true;
 }
コード例 #20
0
ファイル: NotifyCommon_0.php プロジェクト: 62BRAINS/EPESI
 public static function get_notifications()
 {
     $module = 'Base_Notify';
     $notifications_date = Base_User_SettingsCommon::get($module, 'last_update');
     if (!$notifications_date) {
         $notifications_date = time() - self::reset_time * 3600;
     }
     Base_User_SettingsCommon::save($module, 'last_update', time());
     return ModuleManager::call_common_methods('tray_notification', false, array($notifications_date));
 }
コード例 #21
0
ファイル: PhotoInstall.php プロジェクト: 62BRAINS/EPESI
 public function install()
 {
     Base_ThemeCommon::install_default_theme('CRM/Contacts/Photo');
     Utils_RecordBrowserCommon::set_tpl('contact', Base_ThemeCommon::get_template_filename('CRM/Contacts/Photo', 'Contact'));
     Utils_RecordBrowserCommon::register_processing_callback('contact', array('CRM_Contacts_PhotoCommon', 'submit_contact'));
     $this->create_data_dir();
     ModuleManager::include_common('CRM_Contacts_Photo', 0);
     DB::CreateTable(CRM_Contacts_PhotoCommon::table_name, 'contact_id I4 KEY,' . 'filename C(48) NOTNULL');
     return true;
 }
コード例 #22
0
ファイル: Dispatcher.php プロジェクト: estrom85/sample-codes
 public function performAction($home)
 {
     $this->module = ModuleManager::getModule($this->app, $this->controller);
     if ($this->module == null) {
         $this->displayErrorPage(401, $home);
     }
     if (!$this->module->execute($this->action, $this->parameters)) {
         $this->displayErrorPage(404, $home);
     }
 }
コード例 #23
0
ファイル: TrayCommon_0.php プロジェクト: cretzu89/EPESI
 public static function get_trays()
 {
     static $trays;
     static $user;
     if (!isset($trays) || $user != Acl::get_user()) {
         $user = Acl::get_user();
         $trays = ModuleManager::call_common_methods('tray', false);
     }
     return $trays;
 }
コード例 #24
0
ファイル: FaxCommon_0.php プロジェクト: cretzu89/EPESI
 public static function fax_file($f, $oryg)
 {
     $tmp = self::Instance()->get_data_dir() . $oryg;
     copy($f, $tmp);
     $x = ModuleManager::get_instance('/Base_Box|0');
     if (!$x) {
         trigger_error('There is no base box module instance', E_USER_ERROR);
     }
     $x->push_main('CRM_Fax', 'send', $tmp);
 }
コード例 #25
0
ファイル: OnlineModuleManager.php プロジェクト: skapl/design
 /**
  * Installs latest compatible module version
  *
  * @param type $moduleId
  */
 public function install($moduleId)
 {
     $modulePath = Yii::app()->getModulePath();
     if (!is_writable($modulePath)) {
         throw new CHttpException(500, Yii::t('AdminModule.libs_OnlineModuleManager', 'Module directory %modulePath% is not writeable!', array('%modulePath%' => $modulePath)));
     }
     $moduleInfo = $this->getModuleInfo($moduleId);
     if (!isset($moduleInfo['latestCompatibleVersion'])) {
         throw new CException(Yii::t('AdminModule.libs_OnlineModuleManager', "No compatible module version found!"));
     }
     if (is_dir($modulePath . DIRECTORY_SEPARATOR . $moduleId)) {
         throw new CHttpException(500, Yii::t('AdminModule.libs_OnlineModuleManager', 'Module directory for module %moduleId% already exists!', array('%moduleId%' => $moduleId)));
     }
     // Check Module Folder exists
     $moduleDownloadFolder = Yii::app()->getRuntimePath() . DIRECTORY_SEPARATOR . 'module_downloads';
     if (!is_dir($moduleDownloadFolder)) {
         if (!@mkdir($moduleDownloadFolder)) {
             throw new CException("Could not create module download folder!");
         }
     }
     $version = $moduleInfo['latestCompatibleVersion'];
     // Download
     $downloadUrl = $version['downloadUrl'];
     $downloadTargetFileName = $moduleDownloadFolder . DIRECTORY_SEPARATOR . basename($downloadUrl);
     try {
         $http = new Zend_Http_Client($downloadUrl, array('adapter' => 'Zend_Http_Client_Adapter_Curl', 'curloptions' => $this->getCurlOptions(), 'timeout' => 30));
         $response = $http->request();
         file_put_contents($downloadTargetFileName, $response->getBody());
     } catch (Exception $ex) {
         throw new CHttpException('500', Yii::t('AdminModule.libs_OnlineModuleManager', 'Module download failed! (%error%)', array('%error%' => $ex->getMessage())));
     }
     // Extract Package
     if (file_exists($downloadTargetFileName)) {
         // Unzip
         $zip = new ZipArchive();
         $res = $zip->open($downloadTargetFileName);
         if ($res === TRUE) {
             $zip->extractTo($modulePath);
             $zip->close();
         } else {
             throw new CHttpException('500', Yii::t('AdminModule.libs_OnlineModuleManager', 'Could not extract module!'));
         }
     } else {
         throw new CHttpException('500', Yii::t('AdminModule.libs_OnlineModuleManager', 'Download of module failed!'));
     }
     ModuleManager::flushCache();
     // Call Modules autostart
     $autostartFilename = $modulePath . DIRECTORY_SEPARATOR . $moduleId . DIRECTORY_SEPARATOR . 'autostart.php';
     if (file_exists($autostartFilename)) {
         require_once $autostartFilename;
         $module = Yii::app()->moduleManager->getModule($moduleId);
         $module->install();
     }
 }
コード例 #26
0
ファイル: SetupCommon_0.php プロジェクト: cretzu89/EPESI
 public static function refresh_available_modules()
 {
     $module_dirs = ModuleManager::list_modules();
     DB::Execute('TRUNCATE TABLE available_modules');
     foreach ($module_dirs as $name => $v) {
         foreach ($v as $ver => $u) {
             DB::Execute('INSERT INTO available_modules VALUES(%s, %d, %s)', array($name, $ver, $u));
         }
     }
     return $module_dirs;
 }
コード例 #27
0
ファイル: AdminModulesPresenter.php プロジェクト: bazo/Mokuji
 public function handleChangeStatus($module_name, $new_status)
 {
     ModuleManager::changeStatus($module_name, $new_status);
     $this['page']->refresh('modules');
     if ($new_status == 'enabled') {
         Environment::getApplication()->installModules();
         $this->invalidateControl('menu');
     } else {
         $this->redirect('this');
     }
 }
コード例 #28
0
ファイル: CalendarCommon_0.php プロジェクト: cretzu89/EPESI
 public static function view_event($func, $def)
 {
     $x = ModuleManager::get_instance('/Base_Box|0');
     if (!$x) {
         trigger_error('There is no base box module instance', E_USER_ERROR);
     }
     if ($func == 'add') {
         $def = array(date('Y-m-d H:i:s'), false, $def);
     }
     $x->push_main('CRM_Calendar_Event', $func, $def);
 }
コード例 #29
0
ファイル: ContactsInstall.php プロジェクト: cretzu89/EPESI
 public function install()
 {
     Base_ThemeCommon::install_default_theme(CRM_ContactsInstall::module_name());
     Utils_RecordBrowserCommon::register_datatype('crm_company', 'CRM_ContactsCommon', 'crm_company_datatype');
     Utils_RecordBrowserCommon::register_datatype('crm_contact', 'CRM_ContactsCommon', 'crm_contact_datatype');
     Utils_RecordBrowserCommon::register_datatype('crm_company_contact', 'CRM_ContactsCommon', 'crm_company_contact_datatype');
     Utils_RecordBrowserCommon::register_datatype('email', 'CRM_ContactsCommon', 'email_datatype');
     ModuleManager::include_common('CRM_Contacts', 0);
     // ************ companies ************** //
     $fields = array(array('name' => _M('Company Name'), 'type' => 'text', 'required' => true, 'param' => '128', 'extra' => false, 'visible' => true, 'display_callback' => array('Utils_RecordBrowserCommon', 'display_linked_field_label'), 'QFfield_callback' => array('CRM_ContactsCommon', 'QFfield_cname')), array('name' => _M('Short Name'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'visible' => false), array('name' => _M('Phone'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'visible' => true, 'display_callback' => array('CRM_ContactsCommon', 'display_phone')), array('name' => _M('Fax'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true), array('name' => _M('Email'), 'type' => 'email', 'required' => false, 'param' => array('unique' => true), 'extra' => true, 'visible' => false), array('name' => _M('Web address'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'display_callback' => array('CRM_ContactsCommon', 'display_webaddress'), 'QFfield_callback' => array('CRM_ContactsCommon', 'QFfield_webaddress')), array('name' => _M('Group'), 'type' => 'multiselect', 'required' => false, 'visible' => true, 'param' => Utils_RecordBrowserCommon::multiselect_from_common('Companies_Groups'), 'extra' => false, 'filter' => true), array('name' => _M('Permission'), 'type' => 'commondata', 'required' => true, 'param' => array('order_by_key' => true, 'CRM/Access'), 'extra' => true), array('name' => _M('Address 1'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'display_callback' => array('CRM_ContactsCommon', 'maplink')), array('name' => _M('Address 2'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'display_callback' => array('CRM_ContactsCommon', 'maplink')), array('name' => _M('City'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'visible' => true, 'display_callback' => array('CRM_ContactsCommon', 'maplink')), array('name' => _M('Country'), 'type' => 'commondata', 'required' => true, 'param' => array('Countries'), 'extra' => true, 'QFfield_callback' => array('Data_CountriesCommon', 'QFfield_country')), array('name' => _M('Zone'), 'type' => 'commondata', 'required' => false, 'param' => array('Countries', 'Country'), 'extra' => true, 'visible' => true, 'QFfield_callback' => array('Data_CountriesCommon', 'QFfield_zone')), array('name' => _M('Postal Code'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true), array('name' => _M('Tax ID'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'QFfield_callback' => array('CRM_ContactsCommon', 'QFfield_tax_id')));
     Utils_RecordBrowserCommon::install_new_recordset('company', $fields);
     // ************ contacts ************** //
     $fields = array(array('name' => _M('Last Name'), 'type' => 'text', 'required' => true, 'param' => '64', 'extra' => false, 'visible' => true, 'display_callback' => array('Utils_RecordBrowserCommon', 'display_linked_field_label')), array('name' => _M('First Name'), 'type' => 'text', 'required' => true, 'param' => '64', 'extra' => false, 'visible' => true, 'display_callback' => array('Utils_RecordBrowserCommon', 'display_linked_field_label')), array('name' => _M('Company Name'), 'type' => 'crm_company', 'param' => array('field_type' => 'select'), 'required' => false, 'extra' => false, 'visible' => true, 'filter' => true), array('name' => _M('Related Companies'), 'type' => 'crm_company', 'param' => array('field_type' => 'multiselect'), 'required' => false, 'extra' => true, 'visible' => false, 'filter' => true), array('name' => _M('Group'), 'type' => 'multiselect', 'required' => false, 'param' => Utils_RecordBrowserCommon::multiselect_from_common('Contacts_Groups'), 'extra' => true, 'filter' => true), array('name' => _M('Title'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true), array('name' => _M('Work Phone'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'visible' => true, 'display_callback' => array('CRM_ContactsCommon', 'display_phone')), array('name' => _M('Mobile Phone'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'visible' => true, 'display_callback' => array('CRM_ContactsCommon', 'display_phone')), array('name' => _M('Fax'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true), array('name' => _M('Email'), 'type' => 'email', 'required' => false, 'param' => array('unique' => true), 'extra' => false, 'visible' => false), array('name' => _M('Web address'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'display_callback' => array('CRM_ContactsCommon', 'display_webaddress'), 'QFfield_callback' => array('CRM_ContactsCommon', 'QFfield_webaddress')), array('name' => _M('Address 1'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'display_callback' => array('CRM_ContactsCommon', 'maplink')), array('name' => _M('Address 2'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'display_callback' => array('CRM_ContactsCommon', 'maplink')), array('name' => _M('City'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'visible' => true, 'display_callback' => array('CRM_ContactsCommon', 'maplink')), array('name' => _M('Country'), 'type' => 'commondata', 'required' => true, 'param' => array('Countries'), 'extra' => true, 'visible' => false, 'QFfield_callback' => array('Data_CountriesCommon', 'QFfield_country')), array('name' => _M('Zone'), 'type' => 'commondata', 'required' => false, 'param' => array('Countries', 'Country'), 'extra' => true, 'visible' => true, 'QFfield_callback' => array('Data_CountriesCommon', 'QFfield_zone')), array('name' => _M('Postal Code'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true), array('name' => _M('Permission'), 'type' => 'commondata', 'required' => true, 'param' => array('order_by_key' => true, 'CRM/Access'), 'extra' => true), array('name' => _M('Details'), 'type' => 'page_split'), array('name' => _M('Home Phone'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'display_callback' => array('CRM_ContactsCommon', 'display_phone')), array('name' => _M('Home Address 1'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'display_callback' => array('CRM_ContactsCommon', 'home_maplink')), array('name' => _M('Home Address 2'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'display_callback' => array('CRM_ContactsCommon', 'home_maplink')), array('name' => _M('Home City'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true, 'display_callback' => array('CRM_ContactsCommon', 'home_maplink')), array('name' => _M('Home Country'), 'type' => 'commondata', 'required' => false, 'param' => array('Countries'), 'extra' => true, 'QFfield_callback' => array('Data_CountriesCommon', 'QFfield_country')), array('name' => _M('Home Zone'), 'type' => 'commondata', 'required' => false, 'param' => array('Countries', 'Home Country'), 'extra' => true, 'QFfield_callback' => array('Data_CountriesCommon', 'QFfield_zone')), array('name' => _M('Home Postal Code'), 'type' => 'text', 'required' => false, 'param' => '64', 'extra' => true), array('name' => _M('Birth Date'), 'type' => 'date', 'required' => false, 'param' => 64, 'extra' => true), array('name' => _M('Login Panel'), 'type' => 'page_split', 'param' => 1), array('name' => _M('Login'), 'type' => 'integer', 'required' => false, 'param' => '64', 'extra' => false, 'display_callback' => array('CRM_ContactsCommon', 'display_login'), 'QFfield_callback' => array('CRM_ContactsCommon', 'QFfield_login'), 'style' => ''), array('name' => _M('Username'), 'type' => 'calculated', 'required' => false, 'extra' => false, 'QFfield_callback' => array('CRM_ContactsCommon', 'QFfield_username')), array('name' => _M('Set Password'), 'type' => 'calculated', 'required' => false, 'extra' => false, 'QFfield_callback' => array('CRM_ContactsCommon', 'QFfield_password')), array('name' => _M('Confirm Password'), 'type' => 'calculated', 'required' => false, 'extra' => false, 'QFfield_callback' => array('CRM_ContactsCommon', 'QFfield_repassword')), array('name' => _M('Admin'), 'type' => 'calculated', 'required' => false, 'extra' => false, 'QFfield_callback' => array('CRM_ContactsCommon', 'QFfield_admin'), 'display_callback' => array('CRM_ContactsCommon', 'display_admin')), array('name' => _M('Access'), 'type' => 'multiselect', 'required' => false, 'param' => Utils_RecordBrowserCommon::multiselect_from_common('Contacts/Access'), 'extra' => false, 'QFfield_callback' => array('CRM_ContactsCommon', 'QFfield_access')));
     Utils_RecordBrowserCommon::install_new_recordset('contact', $fields);
     DB::CreateIndex('contact_data_1__f_login_idx', 'contact_data_1', 'f_login,active');
     // ************ company settings ************** //
     Utils_RecordBrowserCommon::register_processing_callback('company', array('CRM_ContactsCommon', 'submit_company'));
     Utils_RecordBrowserCommon::set_quickjump('company', 'Company Name');
     Utils_RecordBrowserCommon::set_favorites('company', true);
     Utils_RecordBrowserCommon::set_recent('company', 15);
     Utils_RecordBrowserCommon::set_caption('company', _M('Companies'));
     Utils_RecordBrowserCommon::set_icon('company', Base_ThemeCommon::get_template_filename(CRM_ContactsInstall::module_name(), 'companies.png'));
     Utils_RecordBrowserCommon::set_description_callback('company', array('CRM_ContactsCommon', 'company_format_default'));
     Utils_RecordBrowserCommon::enable_watchdog('company', array('CRM_ContactsCommon', 'company_watchdog_label'));
     Utils_RecordBrowserCommon::set_clipboard_pattern('company', "%{{company_name}<BR>}\n%{{address_1}<BR>}\n%{{address_2}<BR>}\n%{%{{city} }%{{zone} }{postal_code}<BR>}\n%{{country}<BR>}\n%{tel. {phone}<BR>}\n%{fax. {fax}<BR>}\n%{{web_address}<BR>}");
     // ************ contacts settings ************** //
     Utils_RecordBrowserCommon::set_tpl('contact', Base_ThemeCommon::get_template_filename(CRM_ContactsInstall::module_name(), 'Contact'));
     Utils_RecordBrowserCommon::register_processing_callback('contact', array('CRM_ContactsCommon', 'submit_contact'));
     Utils_RecordBrowserCommon::set_quickjump('contact', 'Last Name');
     Utils_RecordBrowserCommon::set_favorites('contact', true);
     Utils_RecordBrowserCommon::set_recent('contact', 15);
     Utils_RecordBrowserCommon::set_caption('contact', _M('Contacts'));
     Utils_RecordBrowserCommon::set_icon('contact', Base_ThemeCommon::get_template_filename(CRM_ContactsInstall::module_name(), 'icon.png'));
     Utils_RecordBrowserCommon::set_description_callback('contact', array('CRM_ContactsCommon', 'contact_format_default'));
     Utils_RecordBrowserCommon::enable_watchdog('contact', array('CRM_ContactsCommon', 'contact_watchdog_label'));
     Utils_RecordBrowserCommon::set_clipboard_pattern('contact', "%{{first_name} {last_name}<BR>}\n%{{title}<BR>}\n%{{company_name}<BR>}\n%{{address_1}<BR>}\n%{{address_2}<BR>}\n%{%{{city} }%{{zone} }{postal_code}<BR>}\n%{{country}<BR>}\n%{tel. {work_phone}<BR>}\n%{{email}<BR>}");
     // ************ addons ************** //
     Utils_RecordBrowserCommon::new_addon('company', CRM_ContactsInstall::module_name(), 'company_addon', _M('Contacts'));
     Utils_AttachmentCommon::new_addon('company');
     Utils_AttachmentCommon::new_addon('contact');
     // ************ other ************** //
     Utils_CommonDataCommon::new_array('Companies_Groups', array('customer' => _M('Customer'), 'vendor' => _M('Vendor'), 'other' => _M('Other'), 'manager' => _M('Manager')), true, true);
     Utils_CommonDataCommon::new_array('Contacts_Groups', array('office' => _M('Office Staff'), 'field' => _M('Field Staff'), 'custm' => _M('Customer')), true, true);
     Utils_CommonDataCommon::new_array('Contacts/Access', array('manager' => _M('Manager')), true, true);
     Utils_BBCodeCommon::new_bbcode('contact', 'CRM_ContactsCommon', 'contact_bbcode');
     Utils_BBCodeCommon::new_bbcode('company', 'CRM_ContactsCommon', 'company_bbcode');
     Utils_RecordBrowserCommon::set_search('company', 1, 2);
     Utils_RecordBrowserCommon::set_search('contact', 1, 2);
     Base_AclCommon::add_clearance_callback(array('CRM_ContactsCommon', 'crm_clearance'));
     Utils_CommonDataCommon::extend_array('Contacts/Access', array('employee' => _M('Employee')));
     self::install_permissions();
     return true;
 }
コード例 #30
0
ファイル: HomePageCommon_0.php プロジェクト: cretzu89/EPESI
 public static function get_home_pages()
 {
     static $cache = null;
     if ($cache === null) {
         $cache = array();
         $tmp = ModuleManager::call_common_methods('home_page');
         foreach ($tmp as $k => $v) {
             $cache = array_merge($cache, $v);
         }
     }
     return $cache;
 }