function WriteData(&$data) { $this->count++; if (isset($this->block_title) && strlen($this->block_title) > 0) { if (preg_match("/(\\.[^\\/\\\\]+)\\s*\$/", $data, $m)) { $title = $this->block_title . $m[1]; } else { $title = $this->block_title; } } else { $title = basename($data); } if (in_array($title, $this->list)) { if (preg_match("/^(.*)(\\.[^\\/\\\\]+)\\s*\$/", $title, $m)) { $base = $m[1]; $ext = $m[2]; } else { $base = $title; $ext = ""; } $i = 0; do { $title = $base . ++$i . $ext; } while (in_array($title, $this->list)); } array_push($this->list, $title); if ($this->zip->open($this->tmpfile, ZIPARCHIVE::CREATE) !== true) { throw new ADEIException(translate("Can't open/create ZIP archive (%s)", $this->tmpfile)); } $this->zip->addFile($data, $title); $this->zip->close(); }
public function __construct() { if (!pageArray(2) || !pageArray(3)) { return false; } $email = pageArray(2); $code = pageArray(3); runHook("action:verify_email:before"); $access = getIgnoreAccess(); setIgnoreAccess(); $user = getEntities(array("type" => "User", "metadata_name_value_pairs" => array(array("name" => "email", "value" => $email), array("name" => "email_verification_code", "value" => $code)))); setIgnoreAccess($access); if (!$user) { new SystemMessage(translate("system_message:email_could_not_be_verified")); forward("home"); } $user = $user[0]; $user->email_verification_code = NULL; $user->verified = "true"; $user->save(); runHook("action:verify_email:after"); new SystemMessage(translate("system_message:email_verified")); new Activity($user->guid, "activity:joined", array($user->getURL(), $user->full_name)); forward("login"); }
function lodgegold_dohook($hookname, $args) { global $session; $cost1 = get_module_setting("cost1", "lodgegold"); $cost2 = get_module_setting("cost2", "lodgegold"); $cost3 = get_module_setting("cost3", "lodgegold"); $gold1 = get_module_setting("gold1", "lodgegold"); $gold2 = get_module_setting("gold2", "lodgegold"); $gold3 = get_module_setting("gold3", "lodgegold"); switch ($hookname) { case "lodge": addnav("Buy Requisition"); $donationsleft = $session['user']['donation'] - $session['user']['donationspent']; if ($donationsleft >= $cost1) { addnav(array("`^%s Gold - `#(%s Points)", $gold1, $cost1), "runmodule.php?module=lodgegold&op=cost1&gold=gold1"); } if ($donationsleft >= $cost2) { addnav(array("`^%s Gold - `#(%s Points)", $gold2, $cost2), "runmodule.php?module=lodgegold&op=cost2&gold=gold2"); } if ($donationsleft >= $cost3) { addnav(array("`^%s Gold - `#(%s Points)", $gold3, $cost3), "runmodule.php?module=lodgegold&op=cost3&gold=gold3"); } break; case "pointsdesc": $args['count']++; $format = $args['format']; $str = translate("Trade in donation points for gold."); $str = sprintf($str, get_module_setting("cost1"), get_module_setting("cost2")); output($format, $str, true); break; } return $args; }
function launch() { global $interface; $id = $_GET['id']; $interface->assign('id', $id); $this->eContentRecord = new EContentRecord(); $this->eContentRecord->id = $_GET['id']; $this->eContentRecord->find(true); $recordDriver = new EcontentRecordDriver(); $recordDriver->setDataObject($this->eContentRecord); $interface->assign('sourceUrl', $this->eContentRecord->sourceUrl); $interface->assign('source', $this->eContentRecord->source); $interface->setPageTitle(translate('Copies') . ': ' . $recordDriver->getBreadcrumb()); $driver = new EContentDriver(); $holdings = $driver->getHolding($id); $showEContentNotes = false; foreach ($holdings as $holding) { if (strlen($holding->notes) > 0) { $showEContentNotes = true; } } $interface->assign('showEContentNotes', $showEContentNotes); $interface->assign('holdings', $holdings); //Load status summary $result = $driver->getStatusSummary($id, $holdings); if (PEAR_Singleton::isError($result)) { PEAR_Singleton::raiseError($result); } $holdingData->holdingsSummary = $result; $interface->assign('subTemplate', 'view-holdings.tpl'); $interface->setTemplate('view-alt.tpl'); // Display Page $interface->display('layout.tpl'); }
/** * Takes in the request params from a save request and processes * them for the save. * * @param REQUEST params $params */ function saveDropDown($params) { require_once 'modules/Administration/Common.php'; $emptyMarker = translate('LBL_BLANK'); $selected_lang = !empty($params['dropdown_lang']) ? $params['dropdown_lang'] : $_SESSION['authenticated_user_language']; $type = $_REQUEST['view_package']; $dir = ''; $dropdown_name = $params['dropdown_name']; $json = getJSONobj(); $list_value = str_replace('"":""', '"__empty__":""', $params['list_value']); //Bug 21362 ENT_QUOTES- convert single quotes to escaped single quotes. $dropdown = $json->decode(html_entity_decode(rawurldecode($list_value), ENT_QUOTES)); if (array_key_exists($emptyMarker, $dropdown)) { unset($dropdown[$emptyMarker]); $dropdown[''] = ''; } if ($type != 'studio') { $mb = new ModuleBuilder(); $module =& $mb->getPackageModule($params['view_package'], $params['view_module']); $this->synchMBDropDown($dropdown_name, $dropdown, $selected_lang, $module); //Can't use synch on selected lang as we want to overwrite values, not just keys $module->mblanguage->appListStrings[$selected_lang . '.lang.php'][$dropdown_name] = $dropdown; $module->mblanguage->save($module->key_name); // tyoung - key is required parameter as of } else { $contents = return_custom_app_list_strings_file_contents($selected_lang); $my_list_strings = return_app_list_strings_language($selected_lang); if ($selected_lang == $GLOBALS['current_language']) { $GLOBALS['app_list_strings'][$dropdown_name] = $dropdown; } //write to contents $contents = str_replace("?>", '', $contents); if (empty($contents)) { $contents = "<?php"; } //add new drop down to the bottom if (!empty($params['use_push'])) { //this is for handling moduleList and such where nothing should be deleted or anything but they can be renamed foreach ($dropdown as $key => $value) { //only if the value has changed or does not exist do we want to add it this way if (!isset($my_list_strings[$dropdown_name][$key]) || strcmp($my_list_strings[$dropdown_name][$key], $value) != 0) { //clear out the old value $pattern_match = '/\\s*\\$app_list_strings\\s*\\[\\s*\'' . $dropdown_name . '\'\\s*\\]\\[\\s*\'' . $key . '\'\\s*\\]\\s*=\\s*[\'\\"]{1}.*?[\'\\"]{1};\\s*/ism'; $contents = preg_replace($pattern_match, "\n", $contents); //add the new ones $contents .= "\n\$GLOBALS['app_list_strings']['{$dropdown_name}']['{$key}']=" . var_export_helper($value) . ";"; } } } else { //Now synch up the keys in other langauges to ensure that removed/added Drop down values work properly under all langs. $this->synchDropDown($dropdown_name, $dropdown, $selected_lang, $dir); $contents = $this->getNewCustomContents($dropdown_name, $dropdown, $selected_lang); } if (!empty($dir) && !is_dir($dir)) { $continue = mkdir_recursive($dir); } save_custom_app_list_strings_contents($contents, $selected_lang, $dir); } sugar_cache_reset(); }
function errorMessage($tag = '') { $toReturn = translate('If you want to install Plugin WIRIS manually, see') . ' <a href="http://www.wiris.com/download/moodle/install.html#' . $tag . '">' . translate('our manual') . '</a>.<br /><br />'; $toReturn .= '<a href="..">' . translate('Return to moodle home.') . '</a><br /><br />'; $toReturn .= '<a href="./install.php">' . translate('Try to reinstall') . '</a>.'; return $toReturn; }
/** * Smarty {sugar_translate} function plugin * * Type: function<br> * Name: sugar_translate<br> * Purpose: translates a label into the users current language * * @author Majed Itani {majed at sugarcrm.com * @param array * @param Smarty */ function smarty_function_sugar_translate($params, &$smarty) { if (!isset($params['label'])) { $smarty->trigger_error("sugar_translate: missing 'label' parameter"); return ''; } $module = isset($params['module']) ? $params['module'] : ''; if (isset($params['select'])) { if (empty($params['select'])) { $value = ""; } else { $value = translate($params['label'], $module, $params['select']); } } else { $value = translate($params['label'], $module); } if (!empty($params['for_js']) && $params['for_js']) { $value = addslashes($value); $value = str_replace(array(''', '''), "\\'", $value); } if (isset($params['trimColon']) && !$params['trimColon']) { return $value; } elseif ($params['label'] == '0') { return translate("DEFAULT", $module); } else { return preg_replace("/([:]|:)[\\s]*\$/", "", $value); } }
/** * set the html for user admin page * this function is registered in xajax * @return xajaxResponse every xajax registered function needs to return this object */ function action_get_user_admin_page() { global $logging; global $user; global $user_admin_table_configuration; global $user_start_time_array; $logging->info("USER_ACTION " . __METHOD__ . " (user="******")"); # store start time $user_start_time_array[__METHOD__] = microtime(TRUE); # create necessary objects $result = new Result(); $response = new xajaxResponse(); $html_database_table = new HtmlDatabaseTable($user_admin_table_configuration); # set page, title, explanation and navigation $response->assign("page_title", "innerHTML", translate("LABEL_USER_ADMIN_TITLE")); $response->assign("navigation_container", "innerHTML", get_page_navigation(PAGE_TYPE_USER_ADMIN)); $html_database_table->get_page(translate("LABEL_USER_ADMIN_TITLE"), $result); $response->assign("main_body", "innerHTML", $result->get_result_str()); # set content $html_database_table->get_content($user, HTML_NO_LIST_PERMISSION_CHECK, "", DATABASETABLE_UNKWOWN_PAGE, $result); $response->custom_response->assign_with_effect(PORTAL_CSS_NAME_PREFIX . "content_pane", $result->get_result_str()); # set action pane $html_str = $html_database_table->get_action_bar(USER_TABLE_NAME, ""); $response->custom_response->assign_and_show("action_pane", $html_str); # set footer $response->assign("footer_text", "innerHTML", " "); # check post conditions if (check_postconditions($result, $response) == FALSE) { return $response; } # log total time for this function $logging->info(get_function_time_str(__METHOD__)); return $response; }
public function action_savelanguages() { global $sugar_config; $toDecode = html_entity_decode($_REQUEST['disabled_langs'], ENT_QUOTES); $disabled_langs = json_decode($toDecode); $toDecode = html_entity_decode($_REQUEST['enabled_langs'], ENT_QUOTES); $enabled_langs = json_decode($toDecode); if (count($sugar_config['languages']) === count($disabled_langs)) { sugar_die(translate('LBL_CAN_NOT_DISABLE_ALL_LANG')); } else { $cfg = new Configurator(); if (in_array($sugar_config['default_language'], $disabled_langs)) { reset($enabled_langs); $cfg->config['default_language'] = current($enabled_langs); } if (in_array($GLOBALS['current_user']->preferred_language, $disabled_langs)) { $GLOBALS['current_user']->preferred_language = current($enabled_langs); $GLOBALS['current_user']->save(); } $cfg->config['disabled_languages'] = join(',', $disabled_langs); // TODO: find way to enforce order $cfg->handleOverride(); // Clear the metadata cache so changes to languages are picked up right away MetaDataManager::refreshLanguagesCache($enabled_langs); require_once 'modules/Administration/QuickRepairAndRebuild.php'; $repair = new RepairAndClear(); $repair->clearLanguageCache(); } //Call Ping API to refresh the language list. die("\n <script>\n var app = window.parent.SUGAR.App;\n app.api.call('read', app.api.buildURL('ping'));\n app.router.navigate('#bwc/index.php?module=Administration&action=Languages', {trigger:true, replace:true});\n </script>"); }
/** * set the html for user settings page * this function is registered in xajax * @return xajaxResponse every xajax registered function needs to return this object */ function action_get_user_settings_page() { global $logging; global $user; global $user_settings_table_configuration; global $firstthingsfirst_portal_title; global $user_start_time_array; $logging->info("USER_ACTION " . __METHOD__ . " (user="******")"); # store start time $user_start_time_array[__METHOD__] = microtime(TRUE); # create necessary objects $result = new Result(); $response = new xajaxResponse(); $html_database_table = new HtmlDatabaseTable($user_settings_table_configuration); # create an array with selection of fields that user may change $db_fields_array = array(DB_ID_FIELD_NAME, USER_NAME_FIELD_NAME, USER_PW_FIELD_NAME, USER_LANG_FIELD_NAME, USER_DATE_FORMAT_FIELD_NAME, USER_DECIMAL_MARK_FIELD_NAME, USER_LINES_PER_PAGE_FIELD_NAME, USER_THEME_FIELD_NAME); $user_record_key_string = DatabaseTable::_get_encoded_key_string(array(DB_ID_FIELD_NAME => $user->get_id())); # set page, title, explanation and navigation $response->assign("page_title", "innerHTML", translate("LABEL_USER_SETTINGS_TITLE")); $response->assign("navigation_container", "innerHTML", get_page_navigation(PAGE_TYPE_USER_SETTINGS)); $html_database_table->get_page(translate("LABEL_USER_SETTINGS_TITLE"), $result); $response->assign("main_body", "innerHTML", $result->get_result_str()); # get action pane for current user $html_database_table->get_record($user, USER_TABLE_NAME, $user_record_key_string, $db_fields_array, $result); $response->custom_response->assign_with_effect("action_pane", $result->get_result_str()); # set footer $response->assign("footer_text", "innerHTML", " "); # check post conditions if (check_postconditions($result, $response) == FALSE) { return $response; } # log total time for this function $logging->info(get_function_time_str(__METHOD__)); return $response; }
function __construct($data) { $guid = $data['guid']; $text = $data['text']; $chat_message = new Chatmessage(); $chat_message->text = $text; $chat_message->owner_guid = getLoggedInUserGuid(); $chat_message->container_guid = $guid; $chat_message->save(); // If recipient is offline, send them an email $chat = getEntity($guid); if (getLoggedInUserGuid() == $chat->user_one) { $recipient_guid = $chat->user_two; } else { $recipient_guid = $chat->user_one; } $recipient = getEntity($recipient_guid); if ($recipient->online == "false") { $offline_chats = $recipient->offline_chats; if (!is_array($offline_chats)) { $offline_chats = array(getLoggedInUserGuid()); $recipient->offline_chats = $offline_chats; $recipient->save(); } if (!in_array(getLoggedInUserGuid(), $recipient->offline_chats)) { $recipient->offline_chats[] = getLoggedInUserGuid(); $recipient->save(); } $setting = $recipient->notify_offline_chat; if ($setting == "yes") { new Email(array("to" => array("name" => "", "email" => ""), "from" => array("name" => "", "email" => ""), "subject" => translate("offline_message_email_subject"), "body" => translate("offline_message_email_body"), "html" => true)); } } }
/** * @see SugarView::_getModuleTitleParams() */ protected function _getModuleTitleParams($browserTitle = false) { global $mod_strings; $returnAction = 'DetailView'; $returnModule = 'Users'; $returnId = $GLOBALS['current_user']->id; $returnName = $GLOBALS['current_user']->full_name; if (!empty($_REQUEST['return_action']) && !empty($_REQUEST['return_module'])) { if ('Users' == $_REQUEST['return_module']) { if ('EditView' == $_REQUEST['return_action']) { $returnAction = 'EditView'; } if (!empty($_REQUEST['return_name'])) { $returnName = $_REQUEST['return_name']; } if (!empty($_REQUEST['user_id'])) { $returnId = $_REQUEST['user_id']; } } } $this->_returnId = $returnId; $iconPath = $this->getModuleTitleIconPath($this->module); $params = array(); if (!empty($iconPath) && !$browserTitle) { $params[] = "<a href='index.php?module=Users&action=index'><!--not_in_theme!--><img src='{$iconPath}' alt='" . translate('LBL_MODULE_NAME', 'Users') . "' title='" . translate('LBL_MODULE_NAME', 'Users') . "' align='absmiddle'></a>"; } else { $params[] = translate('LBL_MODULE_NAME', 'Users'); } $params[] = "<a href='index.php?module={$returnModule}&action=EditView&record={$returnId}'>" . $returnName . "</a>"; if ($returnAction == 'EditView') { $params[] = $GLOBALS['app_strings']['LBL_EDIT_BUTTON_LABEL']; } return $params; }
function parse_template_bean($string, $bean_name, &$focus) { $repl_arr = array(); foreach ($focus->field_defs as $field_def) { if ($field_def['type'] == 'enum' && isset($field_def['options'])) { $translated = translate($field_def['options'], $bean_name, $focus->{$field_def}['name']); if (isset($translated) && !is_array($translated)) { $repl_arr[strtolower($focus->module_dir) . "_" . $field_def['name']] = $translated; } else { // unset enum field, make sure we have a match string to replace with "" $repl_arr[strtolower($focus->module_dir) . "_" . $field_def['name']] = ''; } } else { $repl_arr[strtolower($focus->module_dir) . "_" . $field_def['name']] = $focus->{$field_def}['name']; } } // end foreach() krsort($repl_arr); reset($repl_arr); foreach ($repl_arr as $name => $value) { if ($value != '' && is_string($value)) { $string = str_replace("\${$name}", $value, $string); } else { $string = str_replace("\${$name}", ' ', $string); } } return $string; }
function get_list_view_data() { $data = parent::get_list_view_data(); $data['VNAME'] = translate($this->vname, $this->custom_module); $data['NAMELINK'] = '<input class="checkbox" type="checkbox" name="remove[]" value="' . $this->id . '"> <a href="index.php?module=Studio&action=wizard&wizard=EditCustomFieldsWizard&option=EditCustomField&record=' . $this->id . '" >'; return $data; }
function display_conflict_between_objects($object_1, $object_2, $field_defs, $module_dir, $display_name) { $mod_strings = return_module_language($GLOBALS['current_language'], 'OptimisticLock'); $title = '<tr><td > </td>'; $object1_row = '<tr class="oddListRowS1"><td><b>' . $mod_strings['LBL_YOURS'] . '</b></td>'; $object2_row = '<tr class="evenListRowS1"><td><b>' . $mod_strings['LBL_IN_DATABASE'] . '</b></td>'; $exists = false; foreach ($field_defs as $name => $ignore) { $value = $object_1[$name]; // FIXME: Replace the comparison here with a function from SugarWidgets if (!is_scalar($value) || $name == 'team_name') { continue; } if ($value != $object_2->{$name} && !$object_2->{$name} instanceof Link) { $title .= '<td ><b> ' . translate($field_defs[$name]['vname'], $module_dir) . '</b></td>'; $object1_row .= '<td> ' . $value . '</td>'; $object2_row .= '<td> ' . $object_2->{$name} . '</td>'; $exists = true; } } if ($exists) { echo "<b>{$mod_strings['LBL_CONFLICT_EXISTS']}<a href='index.php?action=DetailView&module={$module_dir}&record={$object_1['id']}' target='_blank'>{$display_name}</a> </b> <br><table class='list view' border='0' cellspacing='0' cellpadding='2'>{$title}<td > </td></tr>{$object1_row}<td><a href='index.php?&module=OptimisticLock&action=LockResolve&save=true'>{$mod_strings['LBL_ACCEPT_YOURS']}</a></td></tr>{$object2_row}<td><a href='index.php?&module={$object_2->module_dir}&action=DetailView&record={$object_2->id}'>{$mod_strings['LBL_ACCEPT_DATABASE']}</a></td></tr></table><br>"; } else { echo "<b>{$mod_strings['LBL_RECORDS_MATCH']}</b><br>"; } }
public function save($id = null) { $this->load->helper('memberspace/authorization'); $this->load->helper('flashmessages/flashmessages'); $this->load->model('memberspace/user'); $this->load->helper('form'); $datas = array(); if (isset($_POST) && isset($_POST['save-user'])) { $datas = $_POST; unset($_POST['save-user']); if (isset($_POST['id']) && $_POST['id']) { if (!user_can('update', 'user', $_POST['id'])) { add_error(translate('Vous ne pouvez pas modifier cet utilisateur')); } } else { if (!user_can('add', 'user', $_POST['id'])) { add_error(translate('Vous ne pouvez pas ajouter d\'utilisateur')); } } if ($this->user->fromPost() !== false) { add_success(translate('L\'utilisateur a bien été ajouté')); redirect('bo/users/all'); } else { add_error($this->form_validation->error_string()); } } else { if ($id) { $datas = $this->user->getId($id, 'array'); } } return $datas; }
public function init() { $firstName = new Monkeys_Form_Element_Text('firstname'); translate('First Name'); $firstName->setLabel('First Name')->setRequired(true); $lastName = new Monkeys_Form_Element_Text('lastname'); translate('Last Name'); $lastName->setLabel('Last Name')->setRequired(true); $email = new Monkeys_Form_Element_Text('email'); translate('E-mail'); $email->setLabel('E-mail')->addFilter('StringToLower')->setRequired(true)->addValidator('EmailAddress'); $username = new Monkeys_Form_Element_Text('username'); translate('Username'); $username->setLabel('Username')->addValidator(new Monkeys_Validate_Username())->setRequired(true); $password1 = new Monkeys_Form_Element_Password('password1'); translate('Enter desired password'); $passwordValidator = new Monkeys_Validate_Password(); $password1->setLabel('Enter desired password')->setRequired(true)->addValidator(new Monkeys_Validate_PasswordConfirmation())->addValidator($passwordValidator); if ($restrictions = $passwordValidator->getPasswordRestrictionsDescription()) { $password1->setDescription($restrictions); } $password2 = new Monkeys_Form_Element_Password('password2'); translate('Enter password again'); $password2->setLabel('Enter password again')->setRequired(true); // ZF has some bugs when using mutators here, so I have to use the config array translate('Please enter the text below'); $captcha = new Monkeys_Form_Element_Captcha('captcha', array('label' => 'Please enter the text below', 'captcha' => array('captcha' => 'Image', 'sessionClass' => get_class(Zend_Registry::get('appSession')), 'font' => APP_DIR . '/libs/Monkeys/fonts/Verdana.ttf', 'imgDir' => WEB_DIR . '/captchas', 'imgUrl' => $this->_baseWebDir . '/captchas', 'wordLen' => 4, 'fontSize' => 30, 'timeout' => 300))); $this->addElements(array($firstName, $lastName, $email, $username, $password1, $password2, $captcha)); }
function smarty_function_jquery_validation($params, &$smarty) { // @codingStandardsIgnoreEnd // jquery validation rules that this plugin currently supports $supported_rules = array('required', 'email', 'digits', 'equalTo', 'phoneUS', 'mobileUK'); $messages = array(); $rules = array(); foreach ($supported_rules as $rule) { if (isset($params[$rule])) { switch ($rule) { case 'equalTo': $rules[] = "equalTo:'" . $params['equalToField'] . "'"; $messages[$rule] = translate($params[$rule]); break; default: $rules[] = "{$rule}:true"; $messages[$rule] = translate($params[$rule]); break; } } } // format the output $output = '{' . implode(',', $rules) . ',messages:{'; $first = true; foreach ($messages as $rule => $message) { if (!$first) { $output .= ','; } $output .= "{$rule}:'{$message}'"; $first = false; } $output .= '}}'; return $output; }
function displayList($layout_def) { global $app_strings; $return_module = $_REQUEST['module']; $return_id = $_REQUEST['record']; $module_name = $layout_def['module']; $record_id = $layout_def['fields']['ID']; // calls and meetings are held. $new_status = 'Held'; switch ($module_name) { case 'Tasks': $new_status = 'Completed'; break; } $subpanel = $layout_def['subpanel_id']; if (isset($layout_def['linked_field_set']) && !empty($layout_def['linked_field_set'])) { $linked_field = $layout_def['linked_field_set']; } else { $linked_field = $layout_def['linked_field']; } $refresh_page = 0; if (!empty($layout_def['refresh_page'])) { $refresh_page = 1; } $html = "<a onclick='return sp_del_conf();' href=\"javascript:sub_p_del('{$subpanel}', '{$module_name}', '{$record_id}', {$refresh_page});\">" . SugarThemeRegistry::current()->getImage("delete_inline", "alt=" . translate('LBL_LIST_DELETE', $module_name) . " border='0'") . "</a>"; return $html; }
/** * List items */ function menu_list($row_id = NULL, $search = NULL, $sort = NULL, $page = 1) { $view = new ListView(); // Row Id for update only row if (!empty($row_id)) { $row_id = 'id = ' . $row_id; } else { $row_id = 'id != 0'; } // Sort if (empty($sort)) { $sort = 'id ASC'; } $limit = PAGER_LIMIT; $offset = $page * $limit - $limit; $db = DataConnection::readOnly(); $total_records = 0; // Search if (!empty($search)) { $search_fields = array('id', 'label', 'func', 'module'); $exceptions = array(); $search_query = build_search_query($search, $search_fields, $exceptions); $menus = $db->menu()->where($row_id)->and($search_query)->order($sort)->limit($limit, $offset); } else { $menus = $db->menu()->where($row_id)->order($sort)->limit($limit, $offset); } $total_records = $db->menu()->count("*"); $i = 0; if (count($menus)) { // Building the header with sorter $headers[] = array('display' => 'Id', 'field' => 'id'); $headers[] = array('display' => 'Label', 'field' => 'label'); $headers[] = array('display' => 'Function', 'field' => 'func'); $headers[] = array('display' => 'Module', 'field' => 'module'); $headers[] = array('display' => 'Edit', 'field' => NULL); $headers[] = array('display' => 'Delete', 'field' => NULL); $headers = build_sort_header('menu_list', 'menu', $headers, $sort); foreach ($menus as $menu) { $j = $i + 1; //This is important for the row update/delete $rows[$j]['row_id'] = $menu['id']; ///////////////////////////////////////////// $rows[$j]['id'] = $menu['id']; $rows[$j]['label'] = $menu['label']; $rows[$j]['func'] = $menu['func']; $rows[$j]['module'] = $menu['module']; if ($menu['system'] == 1) { $disabled = 'disabled'; } else { $disabled = ''; } $rows[$j]['edit'] = theme_link_process_information('', 'menu_edit_form', 'menu_edit_form', 'menu', array('extra_value' => 'id|' . $menu['id'], 'response_type' => 'modal', 'icon' => NATURAL_EDIT_ICON, 'class' => $disabled)); $rows[$j]['delete'] = theme_link_process_information('', 'menu_delete_form', 'menu_delete_form', 'menu', array('extra_value' => 'id|' . $menu['id'], 'response_type' => 'modal', 'icon' => NATURAL_REMOVE_ICON, 'class' => $disabled)); $i++; } } $options = array('show_headers' => TRUE, 'page_title' => translate('Users List'), 'page_subtitle' => translate('Manage Menus'), 'empty_message' => translate('No menu found!'), 'table_prefix' => theme_link_process_information(translate('Create New Menu'), 'menu_create_form', 'menu_create_form', 'menu', array('response_type' => 'modal')), 'pager_items' => build_pager('menu_list', 'menu', $total_records, $limit, $page), 'page' => $page, 'sort' => $sort, 'search' => $search, 'show_search' => TRUE, 'function' => 'menu_list', 'module' => 'menu', 'update_row_id' => '', 'table_form_id' => '', 'table_form_process' => ''); $listview = $view->build($rows, $headers, $options); return $listview; }
function launch() { global $interface; global $finesIndexEngine; global $configArray; $ils = $configArray['Catalog']['ils']; $interface->assign('showDate', $ils == 'Koha' || $ils == 'Horizon'); $interface->assign('showReason', $ils != 'Koha'); $interface->assign('showOutstanding', $ils == 'Koha'); // Get My Fines if ($patron = $this->catalogLogin()) { if (PEAR_Singleton::isError($patron)) { PEAR_Singleton::raiseError($patron); } if ($this->catalog->checkFunction('getMyFines')) { $result = $this->catalog->getMyFines($patron, true); if (!PEAR_Singleton::isError($result)) { $interface->assign('fines', $result); } else { PEAR_Singleton::raiseError($result); } } else { $interface->assign('finesData', translate('This catalog does not support listing fines.')); } } $interface->assign('sidebar', 'MyAccount/account-sidebar.tpl'); $interface->setTemplate('fines.tpl'); $interface->setPageTitle('My Fines'); $interface->display('layout.tpl'); }
protected function constructSmarty() { $smarty = new Sugar_Smarty(); $smarty->assign('translate', true); $smarty->assign('language', "Leads"); $smarty->assign('view_module', "Leads"); $smarty->assign('module', "Leads"); $smarty->assign('helpName', 'listViewEditor'); $smarty->assign('helpDefault', 'modify'); $smarty->assign('title', 'Convert Layout'); $modules = $this->getModulesFromDefs(); $smarty->assign('modules', $this->jsonHelper->encode($modules)); require_once 'modules/ModuleBuilder/parsers/relationships/DeployedRelationships.php'; $relatableModules = DeployedRelationships::findRelatableModules(); //pull out modules that have already been chosen foreach ($modules as $mDef) { if (isset($relatableModules[$mDef['module']])) { unset($relatableModules[$mDef['module']]); } } $displayModules = array(); $moduleDefaults = array(); foreach ($relatableModules as $mod => $def) { if ($this->parser->isModuleAllowedInConvert($mod)) { $displayModules[$mod] = translate($mod); $moduleDefaults[$mod] = $this->parser->getDefaultDefForModule($mod); } } $smarty->assign('availableModules', $displayModules); $smarty->assign('moduleDefaults', $this->jsonHelper->encode($moduleDefaults)); return $smarty; }
function getBody() { global $locale; $d_image = explode('?', SugarThemeRegistry::current()->getImageURL('company_logo.png')); return '<table style="width: 100%;" border="0" cellspacing="2" cellpadding="2"> <tbody style="text-align: left;"> <tr> <td valign="top"> <p><img src="' . $d_image[0] . '" style="float: left;"/> </p> </td> <td style="font-weight: bold; text-align: right;"><div>' . translate('LBL_BROWSER_TITLE') . ' Ltd<br />' . translate('LBL_ANY_STREET', 'AOS_PDF_Templates') . '<br />' . translate('LBL_ANY_TOWN', 'AOS_PDF_Templates') . '</span><br />' . translate('LBL_ANY_WHERE', 'AOS_PDF_Templates') . '</div></td> </tr> </tbody> </table> <div><br /></div> <div>$accounts_name<br /> $accounts_billing_address_street<br /> $accounts_billing_address_city<br /> $accounts_billing_address_state<br /> $accounts_billing_address_postalcode</div> <div><br /></div> <div>{DATE ' . $locale->getPrecedentPreference('default_date_format') . '}</div> <div><br /></div> <p>Dear $accounts_name</p> <p>OpenSales was originally designed and conceived by Rustin Phares. In 2009, when Rustin could no longer devote time to the project, which is an important one for the Community Edition of SugarCRM, SalesAgility approached him to seek permission to pick up where he had left off.</p> <p>In early 2010 we released the first iteration of what was now to be called "Advanced OpenSales". Since then there have been regular releases to bring Advanced OpenSales into line with the latest releases of SugarCRM and to advance the functionality.</p> <p>2011 saw a complete rewrite of Advanced OpenSales to bring it into line with the 5.x and 6.x architectures and the introduction of an Invoice module. In March 2011, an Invoicing module for SugarCRM Professional Edition was also released.</p> <p>Advanced OpenSales is released under the Affero General Purpose License meaning it's Open Source and freely available. That does not mean that there is no cost involved in making it. Thousands of man hours have gone in to developing and maintaining these modules. Any contributions that assist us in keeping the project on an even keel are gratefully received.</p> <p>SalesAgility are SugarCRM experts. With offices in Manchester and Central Scotland, we're ideally placed to serve your SugarCRM requirements. As consultants, we design and implement tailored Sugar CRM instances. As software developers, we design and deliver customised instances of Sugar CRM that meet the more specialist needs of our clients. As a support organisation we deliver training, hosting and help-desk services to ensure that our clients continue to get best value from their Sugar investment.</p> <p>Yours sincerely</p> <p> </p> <p> </p> <p>Someone</p>'; }
function get_list_view_data() { $data = parent::get_list_view_data(); $data['LABEL'] = translate($this->label, $this->custom_module); $data['NAMELINK'] = '<a href="index.php?module=Studio&action=wizard&wizard=EditCustomFieldsWizard&option=EditCustomField&record=' . $this->id . '" class="listViewTdLinkS1">'; return $data; }
/** * This method prepares the received data and call the addFont method of the fontManager * @return boolean true on success */ private function addFont() { $this->log = ""; $error = false; $files = array("pdf_metric_file", "pdf_font_file"); foreach ($files as $k) { // handle uploaded file $uploadFile = new UploadFile($k); if (isset($_FILES[$k]) && $uploadFile->confirm_upload()) { $uploadFile->final_move(basename($_FILES[$k]['name'])); $uploadFileNames[$k] = $uploadFile->get_upload_path(basename($_FILES[$k]['name'])); } else { $this->log = translate('ERR_PDF_NO_UPLOAD', "Configurator"); $error = true; } } if (!$error) { require_once 'include/Sugarpdf/FontManager.php'; $fontManager = new FontManager(); $error = $fontManager->addFont($uploadFileNames["pdf_font_file"], $uploadFileNames["pdf_metric_file"], $_REQUEST['pdf_embedded'], $_REQUEST['pdf_encoding_table'], array(), htmlspecialchars_decode($_REQUEST['pdf_cidinfo'], ENT_QUOTES), $_REQUEST['pdf_style_list']); $this->log .= $fontManager->log; if ($error) { $this->log .= implode("\n", $fontManager->errors); } } return $error; }
public function display() { global $current_user, $current_language, $sugar_flavor, $sugar_config; if (!$current_user->is_admin) { sugar_die(translate("LBL_MUST_BE_ADMIN")); } //RemoveTabSave: let dashboard pass since we are still altering it if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'RemoveTabSave') { if (isset($_REQUEST['TabToRemove'])) { $dashboardManager = BeanFactory::newBean("dash_DashboardManager"); $dashboardManager->temp_unencoded_pages = $dashboardManager->deletePageByKey($_REQUEST['TabToRemove'], $current_user->getPreference('pages', 'Home')); $dashboardManager->temp_unencoded_dashlets = $current_user->getPreference('dashlets', 'Home'); $dashboardManager->setDashboardForUser($current_user); $current_user->getPreference('pages', 'Home'); $current_user->getPreference('dashlets', 'Home'); } } elseif (isset($this->bean->fetched_row['id'])) { //set this dashboard for current user $this->bean->setDashboardForUser($current_user); } else { //set dashboard back to clean template $current_user->resetPreferences('Home'); } parent::display(); //get language for dashboard $mod_strings = return_module_language($current_language, 'Home'); //render dashboard $lock_homepage = $sugar_config['lock_homepage']; $sugar_config['lock_homepage'] = false; require_once "modules/Home/index.php"; $sugar_config['lock_homepage'] = $lock_homepage; }
function GetGroupInfo(LOGGROUP $grp = NULL, $flags = 0) { $groups = array(); $res = $this->cache->ListCachedGroups(); foreach ($res as $gid) { if ($grp && strcmp($grp->gid, $gid)) { continue; } $groups[$gid] = array('gid' => $gid, 'name' => $gid); if ($flags & REQUEST::NEED_INFO) { $postfix = $this->cache->GetCachePostfix($gid); $info = $this->cache->GetCacheInfo($postfix, $flags & REQUEST::FLAG_MASK); if (!$info) { throw new ADEIException(translate("The CACHE for group (%s) is empty", $grp->gid)); } foreach ($info as $key => &$value) { $groups[$gid][$key] = $value; } if ($flags & REQUEST::NEED_ITEMINFO) { $groups[$gid]['items'] = $this->cache->GetCacheItemList($postfix); } } } return $grp ? $groups[$grp->gid] : $groups; }
public static function __($text, $domain = null) { if (!$domain) { $domain = Core::ID; } return \translate($text, $domain); }
function display() { $this->fromModuleBuilder = isset($_REQUEST['MB']) || !empty($_REQUEST['view_package']) && $_REQUEST['view_package'] != 'studio'; if ($this->fromModuleBuilder) { return; //no support for MB } global $current_user; global $mod_strings; $smarty = new Sugar_Smarty(); $smarty->assign('title', $mod_strings['LBL_DEVELOPER_TOOLS']); $smarty->assign('question', $mod_strings['LBL_QUESTION_ADD_LAYOUT']); $smarty->assign('mod_strings', $mod_strings); $module_name = $_REQUEST['view_module']; // set up language files //$smarty->assign ( 'language', $parser->getLanguage() ) ; // for sugar_translate in the smarty template //$smarty->assign('from_mb',$this->fromModuleBuilder); $mb = new ModuleBuilder(); if (!isset($_REQUEST['view_package'])) { $_REQUEST['view_package'] = 'studio'; } $module =& $mb->getPackageModule($_REQUEST['view_package'], $_REQUEST['view_module']); $package = $mb->packages[$_REQUEST['view_package']]; $package->loadModuleTitles(); $ajax = new AjaxCompose(); $ajax->addCrumb(translate('LBL_STUDIO', 'ModuleBuilder'), 'ModuleBuilder.main("studio")'); $ajax->addCrumb(translate($module_name), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view_module=' . $module_name . '")'); $ajax->addCrumb(translate('LBL_LAYOUTS', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=addlayout&layouts=1&view_module=' . $module_name . '")'); $ajax->addCrumb($mod_strings['LBL_ADD_LAYOUT'], ''); //$ajax->addSection ( 'center', $moduleName . ' ' . translate('LBL_ADD_LAYOUT'), $html = $smarty->fetch('modules/ModuleBuilder/tpls/addlayoutdone.tpl'); $html .= "<script>ModuleBuilder.treeRefresh('Studio')</script>"; $ajax->addSection('center', $mod_strings['LBL_ADD_LAYOUT'], $html); echo $ajax->getJavascript(); }
function DbError() { if (pg_connection_status($this->ConnectionID) != 0) { return translate("ERROR_DBCONNECT_3"); } return pg_last_error($this->ConnectionID); }