/**
  * @see ViewQuickcreate::display()
  */
 public function display()
 {
     $userPref = $GLOBALS['current_user']->getPreference('email_link_type');
     $defaultPref = $GLOBALS['sugar_config']['email_default_client'];
     if ($userPref != '') {
         $client = $userPref;
     } else {
         $client = $defaultPref;
     }
     if ($client == 'sugar') {
         $eUi = new EmailUI();
         if (!empty($this->bean->id) && !in_array($this->bean->object_name, array('EmailMan'))) {
             $fullComposeUrl = "index.php?module=Emails&action=Compose&parent_id={$this->bean->id}&parent_type={$this->bean->module_dir}";
             $composeData = array('parent_id' => $this->bean->id, 'parent_type' => $this->bean->module_dir);
         } else {
             $fullComposeUrl = "index.php?module=Emails&action=Compose";
             $composeData = array('parent_id' => '', 'parent_type' => '');
         }
         $j_quickComposeOptions = $eUi->generateComposePackageForQuickCreate($composeData, $fullComposeUrl);
         $json_obj = getJSONobj();
         $opts = $json_obj->decode($j_quickComposeOptions);
         $opts['menu_id'] = 'dccontent';
         $ss = new Sugar_Smarty();
         $ss->assign('json_output', $json_obj->encode($opts));
         $ss->display('modules/Emails/templates/dceMenuQuickCreate.tpl');
     } else {
         $emailAddress = '';
         if (!empty($this->bean->id) && !in_array($this->bean->object_name, array('EmailMan')) && !is_null($this->bean->emailAddress)) {
             $emailAddress = $this->bean->emailAddress->getPrimaryAddress($this->bean);
         }
         echo "<script>document.location.href='mailto:{$emailAddress}';lastLoadedMenu=undefined;DCMenu.closeOverlay();</script>";
         die;
     }
 }
 public function testFormatResults()
 {
     $tempPT = new ProductTemplate();
     $tempPT->name = 'MasonUnitTest';
     $tempPT->description = "Unit'test";
     $tempPT->cost_price = 1000;
     $tempPT->discount_price = 800;
     $tempPT->list_price = 1100;
     $tempPT->save();
     $_REQUEST['data'] = '{"conditions":[{"end":"%","name":"name","op":"like_custom","value":""}],"field_list":["name","id","type_id","mft_part_num","cost_price","list_price","discount_price","pricing_factor","description","cost_usdollar","list_usdollar","discount_usdollar","tax_class_name"],"form":"EditView","group":"or","id":"EditView_product_name[1]","limit":"30","method":"query","modules":["ProductTemplates"],"no_match_text":"No Match","order":"name","populate_list":["name_1","product_template_id_1"],"post_onblur_function":"set_after_sqs"}';
     $_REQUEST['query'] = 'MasonUnitTest';
     require_once 'modules/home/quicksearchQuery.php';
     $json = getJSONobj();
     $data = $json->decode(html_entity_decode($_REQUEST['data']));
     if (isset($_REQUEST['query']) && !empty($_REQUEST['query'])) {
         foreach ($data['conditions'] as $k => $v) {
             if (empty($data['conditions'][$k]['value'])) {
                 $data['conditions'][$k]['value'] = $_REQUEST['query'];
             }
         }
     }
     $this->quickSearch = new quicksearchQuery();
     $result = $this->quickSearch->query($data);
     $resultBean = $json->decodeReal($result);
     $this->assertEquals($resultBean['fields'][0]['description'], $tempPT->description);
 }
 public function display()
 {
     global $beanList, $beanFiles, $current_user, $app_strings;
     $moduleDir = empty($_REQUEST['bean']) ? '' : $_REQUEST['bean'];
     $beanName = empty($beanList[$moduleDir]) ? '' : $beanList[$moduleDir];
     $id = empty($_REQUEST['id']) ? '' : $_REQUEST['id'];
     // Bug 40216 - Add support for a custom additionalDetails.php file
     $additionalDetailsFile = $this->getAdditionalDetailsMetadataFile($moduleDir);
     if (empty($beanFiles[$beanName]) || empty($id) || !is_file($additionalDetailsFile)) {
         echo 'bad data';
         die;
     }
     require_once $beanFiles[$beanName];
     require_once $additionalDetailsFile;
     $adFunction = 'additionalDetails' . $beanName;
     if (function_exists($adFunction)) {
         // does the additional details function exist
         $json = getJSONobj();
         $bean = new $beanName();
         $bean->retrieve($id);
         $arr = array_change_key_case($bean->toArray(), CASE_UPPER);
         $results = $adFunction($arr);
         $retArray['body'] = str_replace(array("\rn", "\r", "\n"), array('', '', '<br />'), $results['string']);
         if (!$bean->ACLAccess('EditView')) {
             $results['editLink'] = '';
         }
         $retArray['caption'] = "<div style='float:left'>{$app_strings['LBL_ADDITIONAL_DETAILS']}</div><div style='float: right'>";
         $retArray['caption'] .= "";
         $retArray['width'] = empty($results['width']) ? '300' : $results['width'];
         echo 'result = ' . $json->encode($retArray);
     }
 }
    public function display()
    {
        global $beanList, $beanFiles, $current_user, $app_strings, $app_list_strings;
        $moduleDir = empty($_REQUEST['bean']) ? '' : $_REQUEST['bean'];
        $beanName = empty($beanList[$moduleDir]) ? '' : $beanList[$moduleDir];
        $id = empty($_REQUEST['id']) ? '' : $_REQUEST['id'];
        // Bug 40216 - Add support for a custom additionalDetails.php file
        $additionalDetailsFile = $this->getAdditionalDetailsMetadataFile($moduleDir);
        if (empty($id) || empty($additionalDetailsFile)) {
            echo 'bad data';
            die;
        }
        require_once $additionalDetailsFile;
        $adFunction = 'additionalDetails' . $beanName;
        if (function_exists($adFunction)) {
            // does the additional details function exist
            $json = getJSONobj();
            $bean = BeanFactory::getBean($moduleDir, $id);
            //bug38901 - shows dropdown list label instead of database value
            foreach ($bean->field_name_map as $field => $value) {
                if ($value['type'] == 'enum' && !empty($value['options']) && !empty($app_list_strings[$value['options']]) && isset($app_list_strings[$value['options']][$bean->{$field}])) {
                    $bean->{$field} = $app_list_strings[$value['options']][$bean->{$field}];
                }
            }
            $bean->ACLFilterFields();
            $arr = array_change_key_case($bean->toArray(), CASE_UPPER);
            $results = $adFunction($arr);
            $retArray['body'] = str_replace(array("\rn", "\r", "\n"), array('', '', '<br />'), $results['string']);
            $retArray['caption'] = "<div style='float:left'>{$app_strings['LBL_ADDITIONAL_DETAILS']}</div><div style='float: right'>";
            if (!empty($_REQUEST['show_buttons'])) {
                if ($bean->ACLAccess('EditView')) {
                    $editImg = SugarThemeRegistry::current()->getImageURL('edit_inline.png', false);
                    $results['editLink'] = $this->buildButtonLink($results['editLink']);
                    $retArray['caption'] .= <<<EOC
<a style="text-decoration:none;" title="{$GLOBALS['app_strings']['LBL_EDIT_BUTTON']}" href="{$results['editLink']}">
    <img border=0 src="{$editImg}">
</a>
EOC;
                }
                if ($bean->ACLAccess('DetailView')) {
                    $detailImg = SugarThemeRegistry::current()->getImageURL('view_inline.png', false);
                    $results['viewLink'] = $this->buildButtonLink($results['viewLink']);
                    $retArray['caption'] .= <<<EOC
<a style="text-decoration:none;" title="{$GLOBALS['app_strings']['LBL_VIEW_BUTTON']}" href="{$results['viewLink']}">
    <img border=0 src="{$detailImg}" style="margin-left:2px;">
</a>
EOC;
                }
                $closeImg = SugarThemeRegistry::current()->getImageURL('close.png', false);
                $retArray['caption'] .= <<<EOC
<a title="{$GLOBALS['app_strings']['LBL_ADDITIONAL_DETAILS_CLOSE_TITLE']}" href="javascript:SUGAR.util.closeStaticAdditionalDetails();">
    <img border=0 src="{$closeImg}" style="margin-left:2px;">
</a>
EOC;
            }
            $retArray['caption'] .= "";
            $retArray['width'] = empty($results['width']) ? '300' : $results['width'];
            echo 'result = ' . $json->encode($retArray);
        }
    }
function getSVNumbersHtml($focus, $name, $value, $view)
{
    if ('EditView' != $view && 'DetailView' != $view) {
        return "";
        // skip the rest of the method if another view calls this method
    }
    global $app_list_strings;
    global $sugar_config;
    $json = getJSONobj();
    $svnumbersSmartyArray = $focus->getSVNumbersArray();
    $svnumberQuicksearch = getSVNumberQuicksearch('svnumber', 'svnumber_id');
    $smarty = new Sugar_Smarty();
    $smarty->assign('sugarDateFormat', getSugarCrmLocale('datef'));
    //$smarty->assign('sugarDateFormat', $sugar_config['default_date_format']);
    $smarty->assign('sqsJavaScript', $svnumberQuicksearch);
    $smarty->assign('svnumbersArray', $svnumbersSmartyArray);
    $smarty->assign('languageStringsCommon', getLanguageStrings("common"));
    if ('DetailView' === $view) {
        // transfer ide into ajvascript code so that we can determine the urls in the ajax call
        $smarty->assign('id', $focus->id);
        //		$smarty->assign('languageStringsDocuments', getLanguageStrings('Documents'));
    }
    $sep = get_number_seperators();
    $smarty->assign('sugarDecimalSeperator', $sep[1]);
    return $smarty->fetch('include/oqc/ExternalContracts/SVNumbers.' . $view . '.html');
}
 function getHeaderText($action, $currentModule)
 {
     global $app_strings;
     global $current_user;
     $button = "<form border='0' action='index.php' method='post' name='UsersDetailView' id='UsersDetailView'>\n";
     $button .= "<input type='hidden' name='record' value=''>\n";
     $button .= "<input type='hidden' name='user_id' value='{$_REQUEST['record']}'>\n";
     $button .= "<input type='hidden' name='team_id' value=''>\n";
     $button .= "<input type='hidden' name='module' value='Teams'>\n";
     $button .= "<input type='hidden' name='action' value='AddUserToTeam'>\n";
     $button .= "<input type='hidden' name='return_module' value='Users'>\n";
     $button .= "<input type='hidden' name='return_action' value='" . $action . "'>\n";
     $button .= "<input type='hidden' name='return_id' value='" . $this->focus->id . "'>\n";
     if ($current_user->isAdminForModule('Users')) {
         ///////////////////////////////////////
         ///
         /// SETUP PARENT POPUP
         $popup_request_data = array('call_back_function' => 'set_return_user_and_save', 'form_name' => 'UsersDetailView', 'field_to_name_array' => array('id' => 'record'));
         $json = getJSONobj();
         $encoded_popup_request_data = $json->encode($popup_request_data);
         if (isset($widget_data['mode'])) {
             $popup_mode = $widget_data['mode'];
         } else {
             $popup_mode = 'Single';
         }
         //
         ///////////////////////////////////////
         $button .= "<input title='" . $app_strings['LBL_SELECT_BUTTON_TITLE'] . "' type='button' class='button' value='  " . $app_strings['LBL_SELECT_BUTTON_LABEL'] . "  ' name='button' onclick='open_popup(\"Teams\", 600, 400, \"\", true, true, {$encoded_popup_request_data}, \"MultiSelect\");'>\n";
         //				."  ' name='button' onclick='window.open(\"index.php?module=Teams&action=Popup&html=Popup_picker&form=UsersDetailView&form_submit=true\",\"new\",\"width=600,height=400,resizable=1,scrollbars=1\");'>\n";
     }
     $button .= "</form>\n";
     return $button;
 }
Exemple #7
0
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     global $json;
     $json = getJSONobj();
     $json_config = new json_config();
     if (isset($this->bean->json_id) && !empty($this->bean->json_id)) {
         $javascript = $json_config->get_static_json_server(false, true, 'Calls', $this->bean->json_id);
     } else {
         $this->bean->json_id = $this->bean->id;
         $javascript = $json_config->get_static_json_server(false, true, 'Calls', $this->bean->id);
     }
     $this->ss->assign('JSON_CONFIG_JAVASCRIPT', $javascript);
     if ($this->ev->isDuplicate) {
         $this->bean->status = $this->bean->getDefaultStatus();
     }
     //if
     $this->ss->assign('APPLIST', $GLOBALS['app_list_strings']);
     $repeatIntervals = array();
     for ($i = 1; $i <= self::MAX_REPEAT_INTERVAL; $i++) {
         $repeatIntervals[$i] = $i;
     }
     $this->ss->assign("repeat_intervals", $repeatIntervals);
     $fdow = $GLOBALS['current_user']->get_first_day_of_week();
     $dow = array();
     for ($i = $fdow; $i < $fdow + 7; $i++) {
         $dayIndex = $i % 7;
         $dow[] = array("index" => $dayIndex, "label" => $GLOBALS['app_list_strings']['dom_cal_day_short'][$dayIndex + 1]);
     }
     $this->ss->assign('dow', $dow);
     $this->ss->assign('repeatData', json_encode($this->view_object_map['repeatData']));
     parent::display();
 }
 function display()
 {
     global $mod_strings;
     $smarty = new Sugar_Smarty();
     $mb = new ModuleBuilder();
     //if (!empty($_REQUEST['package'])) {
     if (empty($_REQUEST['package']) && empty($_REQUEST['new'])) {
         $this->generatePackageButtons($mb->getPackageList());
         $smarty->assign('buttons', $this->buttons);
         $smarty->assign('title', $GLOBALS['mod_strings']['LBL_MODULEBUILDER']);
         $smarty->assign("question", $GLOBALS['mod_strings']['LBL_QUESTION_PACKAGE']);
         $smarty->assign("defaultHelp", "mbHelp");
         $ajax = new AjaxCompose();
         $ajax->addCrumb($GLOBALS['mod_strings']['LBL_MODULEBUILDER'], 'ModuleBuilder.getContent("module=ModuleBuilder&action=package")');
         $ajax->addCrumb($GLOBALS['mod_strings']['LBL_PACKAGE_LIST'], '');
         $ajax->addSection('center', $GLOBALS['mod_strings']['LBL_PACKAGE_LIST'], $smarty->fetch('modules/ModuleBuilder/tpls/wizard.tpl'));
         echo $ajax->getJavascript();
     } else {
         $name = !empty($_REQUEST['package']) ? $_REQUEST['package'] : '';
         $mb->getPackage($name);
         require_once 'modules/ModuleBuilder/MB/MBPackageTree.php';
         $mbt = new MBPackageTree();
         $nodes = $mbt->fetchNodes();
         $package_labels = array();
         if (!empty($nodes['tree_data']['nodes'])) {
             foreach ($nodes['tree_data']['nodes'] as $entry) {
                 if (!empty($entry['data']['label']) && $name != $entry['data']['label']) {
                     $package_labels[] = strtoupper($entry['data']['label']);
                 }
             }
         }
         $json = getJSONobj();
         $smarty->assign('package_labels', $json->encode($package_labels));
         $this->package =& $mb->packages[$name];
         $this->loadModuleTypes();
         $this->loadPackageHelp($name);
         $this->package->date_modified = $GLOBALS['timedate']->to_display_date_time($this->package->date_modified);
         $smarty->assign('package', $this->package);
         $smarty->assign('mod_strings', $mod_strings);
         $smarty->assign('package_already_deployed', 'false');
         foreach ($this->package->modules as $a_module) {
             if (in_array($a_module->key_name, $GLOBALS['moduleList'])) {
                 $smarty->assign('package_already_deployed', 'true');
                 break;
             }
         }
         $ajax = new AjaxCompose();
         $ajax->addCrumb($GLOBALS['mod_strings']['LBL_MODULEBUILDER'], 'ModuleBuilder.getContent("module=ModuleBuilder&action=package")');
         if (empty($name)) {
             $name = $mod_strings['LBL_NEW_PACKAGE'];
         }
         $ajax->addCrumb($name, '');
         $html = $smarty->fetch('modules/ModuleBuilder/tpls/MBPackage/package.tpl');
         if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'SavePackage') {
             $html .= "<script>ModuleBuilder.treeRefresh('ModuleBuilder')</script>";
         }
         $ajax->addSection('center', translate('LBL_SECTION_PACKAGE', 'ModuleBuilder'), $html);
         echo $ajax->getJavascript();
     }
 }
function getAttachmentsHtml($focus, $name, $value, $view)
{
    if ('EditView' != $view && 'DetailView' != $view) {
        return "";
        // skip the rest of the method if another view calls this method
    }
    global $app_list_strings;
    $smarty = new Sugar_Smarty();
    if (isset($focus->attachmentsequence)) {
        $c = get_all_linked_attachment_revisions($focus->attachmentsequence);
        // smarty mit Werten befüllen
        $smarty->assign('attachments', buildAttachmentsArray($c));
    } else {
        $smarty->assign('attachments', array());
    }
    // setup the popup link
    $popup_request_data = array('call_back_function' => 'popup_return_document', 'field_to_name_array' => array("id" => "document_id", "document_name" => "document_name", "document_revision_id" => "document_revision_id", "category_id" => "document_category_id", "revision" => "revision"), 'passthru_data' => array('default_category' => $app_list_strings['document_subcategory_dom']['']));
    $revision_request_data = array('call_back_function' => 'revision_return_document', 'field_to_name_array' => array("id" => "document_id", "document_name" => "document_name", "document_revision_id" => "document_revision_id", "category_id" => "document_category_id", "revision" => "revision"), 'passthru_data' => array('default_category' => $app_list_strings['document_subcategory_dom']['']));
    $json = getJSONobj();
    $encoded_request_data = $json->encode($popup_request_data);
    $encoded_revision_request_data = $json->encode($revision_request_data);
    $languageStrings = $json->encode($app_list_strings["oqc"]["Attachments"]);
    $smarty->assign('moduleName', getCurrentModuleName());
    $smarty->assign('languageStringsAttachments', $languageStrings);
    $smarty->assign('open_popup_encoded_request_data', $encoded_request_data);
    $smarty->assign('create_popup_encoded_request_data', $encoded_request_data);
    $smarty->assign('upload_revision_encoded_request_data', $encoded_revision_request_data);
    $smarty->assign('initialFilter', "\"&deleted=0\"");
    // Todo: Hier nur Dokumente zulassen, die für Vertragsanhänge erlaubt sind
    return $smarty->fetch('include/oqc/Attachments/' . $view . '.html');
}
 /**
  * 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('&quot;&quot;:&quot;&quot;', '&quot;__empty__&quot;:&quot;&quot;', $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();
 }
Exemple #11
0
 function getUserConfigJSON()
 {
     global $timedate;
     global $current_user, $sugar_config;
     $json = getJSONobj();
     if (isset($_SESSION['authenticated_user_theme']) && $_SESSION['authenticated_user_theme'] != '') {
         $theme = $_SESSION['authenticated_user_theme'];
     } else {
         $theme = $sugar_config['default_theme'];
     }
     $user_arr = array();
     $user_arr['theme'] = $theme;
     $user_arr['fields'] = array();
     $user_arr['module'] = 'User';
     $user_arr['fields']['id'] = $current_user->id;
     $user_arr['fields']['user_name'] = $current_user->user_name;
     $user_arr['fields']['first_name'] = $current_user->first_name;
     $user_arr['fields']['last_name'] = $current_user->last_name;
     $user_arr['fields']['full_name'] = $current_user->full_name;
     $user_arr['fields']['email'] = $current_user->email1;
     $user_arr['fields']['gmt_offset'] = $timedate->getUserUTCOffset();
     $user_arr['fields']['date_time_format'] = $current_user->getUserDateTimePreferences();
     $str = "\n" . $this->global_registry_var_name . ".current_user = "******";\n";
     return $str;
 }
 function process()
 {
     global $current_user, $timedate, $app_list_strings, $current_language, $mod_strings;
     $mod_strings = return_module_language($current_language, 'ProjectTask');
     parent::process();
     if ($this->viaAJAX) {
         // override for ajax call
         $this->ss->assign('saveOnclick', "onclick='if(check_form(\"projectTaskQuickCreate\")) return SUGAR.subpanelUtils.inlineSave(this.form.id, \"projecttask\"); else return false;'");
         $this->ss->assign('cancelOnclick', "onclick='return SUGAR.subpanelUtils.cancelCreate(\"subpanel_projecttask\")';");
     }
     $this->ss->assign('viaAJAX', $this->viaAJAX);
     $this->javascript = new javascript();
     $this->javascript->setFormName('projectTaskQuickCreate');
     $focus = new ProjectTask();
     $this->javascript->setSugarBean($focus);
     $this->javascript->addAllFields('');
     $this->ss->assign('additionalScripts', $this->javascript->getScript(false));
     $this->ss->assign("STATUS_OPTIONS", get_select_options_with_id($app_list_strings['project_task_status_options'], $focus->status));
     $json = getJSONobj();
     ///////////////////////////////////////
     ///
     /// SETUP PARENT POPUP
     $popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'projectTypeQuickCreate', 'field_to_name_array' => array('id' => 'parent_id', 'name' => 'parent_name'));
     $encoded_parent_popup_request_data = $json->encode($popup_request_data);
     $this->ss->assign('encoded_parent_popup_request_data', $encoded_parent_popup_request_data);
     $popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'projectTaskQuickCreate', 'field_to_name_array' => array('id' => 'account_id', 'name' => 'account_name'));
     $encoded_popup_request_data = $json->encode($popup_request_data);
     $this->ss->assign('encoded_popup_request_data', $encoded_popup_request_data);
 }
Exemple #13
0
function json_get_full_list()
{
    global $beanFiles;
    global $beanList;
    require_once 'include/utils.php';
    require_once $beanFiles[$beanList[$_REQUEST['module']]];
    $json = getJSONobj();
    $where = str_replace('\\', '', rawurldecode($_REQUEST['where']));
    $order = str_replace('\\', '', rawurldecode($_REQUEST['order']));
    $focus = new $beanList[$_REQUEST['module']]();
    $fullList = $focus->get_full_list($order, $where, '');
    $all_fields = array_merge($focus->column_fields, $focus->additional_column_fields);
    $js_fields_arr = array();
    $i = 1;
    // js doesn't like 0 index?
    foreach ($fullList as $note) {
        $js_fields_arr[$i] = array();
        foreach ($all_fields as $field) {
            if (isset($note->{$field})) {
                $note->{$field} = from_html($note->{$field});
                $note->{$field} = preg_replace('/\\r\\n/', '<BR>', $note->{$field});
                $note->{$field} = preg_replace('/\\n/', '<BR>', $note->{$field});
                $js_fields_arr[$i][$field] = addslashes($note->{$field});
            }
        }
        $i++;
    }
    $out = $json->encode($js_fields_arr, true);
    print $out;
}
 function process()
 {
     global $current_user, $timedate, $app_list_strings, $current_language, $mod_strings;
     $mod_strings = return_module_language($current_language, 'Opportunities');
     $json = getJSONobj();
     parent::process();
     list($num_grp_sep, $dec_sep) = get_number_seperators();
     $this->ss->assign('NUM_GRP_SEP', $num_grp_sep);
     $this->ss->assign('DEC_SEP', $dec_sep);
     $this->ss->assign('CURRENCY_ID', $current_user->getPreference('currency'));
     $this->ss->assign("SALES_STAGE_OPTIONS", get_select_options_with_id($app_list_strings['sales_stage_dom'], ''));
     $this->ss->assign("LEAD_SOURCE_OPTIONS", get_select_options_with_id($app_list_strings['lead_source_dom'], ''));
     $this->ss->assign('prob_array', $json->encode($app_list_strings['sales_probability_dom']));
     if ($this->viaAJAX) {
         // override for ajax call
         $this->ss->assign('saveOnclick', "onclick='if(check_form(\"opportunitiesQuickCreate\")) return SUGAR.subpanelUtils.inlineSave(this.form.id, \"opportunities\"); else return false;'");
         $this->ss->assign('cancelOnclick', "onclick='return SUGAR.subpanelUtils.cancelCreate(\"subpanel_opportunities\")';");
     }
     $this->ss->assign('viaAJAX', $this->viaAJAX);
     $this->javascript = new javascript();
     $this->javascript->setFormName('opportunitiesQuickCreate');
     $focus = new Opportunity();
     $this->javascript->setSugarBean($focus);
     $this->javascript->addAllFields('');
     $this->ss->assign('additionalScripts', $this->javascript->getScript(false));
 }
 function get_xtpl_edit()
 {
     $name = $this->name . '_name';
     $id = $this->name;
     $module = $this->ext2;
     $returnXTPL = array();
     $popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'EditView', 'field_to_name_array' => array('id' => $this->name, $this->ext1 => $name));
     $json = getJSONobj();
     $encoded_contact_popup_request_data = $json->encode($popup_request_data);
     $returnXTPL['ENCODED_' . strtoupper($id) . '_POPUP_REQUEST_DATA'] = $encoded_contact_popup_request_data;
     $returnXTPL[strtoupper($id) . '_MODULE'] = $module;
     if (isset($beanList[$module]) && isset($this->bean->{$id})) {
         if (!isset($this->bean->{$name})) {
             $mod_field = $this->ext1;
             global $beanList, $beanFiles;
             $class = $beanList[$module];
             require_once $beanFiles[$class];
             $mod = new $class();
             $mod->retrieve($this->bean->{$id});
             if (isset($mod->{$mod_field})) {
                 $this->bean->{$name} = $mod->{$mod_field};
             }
         }
         $returnXTPL[strtoupper($id)] = $this->bean->{$id};
     }
     if (isset($this->bean->{$name})) {
         $returnXTPL[strtoupper($name)] = $this->bean->{$name};
     }
     return $returnXTPL;
 }
 function process()
 {
     global $current_user, $timedate, $app_list_strings, $current_language, $mod_strings;
     $mod_strings = return_module_language($current_language, 'Contracts');
     parent::process();
     if ($this->viaAJAX) {
         // override for ajax call
         $this->ss->assign('saveOnclick', "onclick='if(check_form(\"contractsQuickCreate\")) return SUGAR.subpanelUtils.inlineSave(this.form.id, \"contracts\"); else return false;'");
         $this->ss->assign('cancelOnclick', "onclick='return SUGAR.subpanelUtils.cancelCreate(\"subpanel_contracts\")';");
     }
     $this->ss->assign('viaAJAX', $this->viaAJAX);
     $this->javascript = new javascript();
     $this->javascript->setFormName('contractsQuickCreate');
     $focus = BeanFactory::getBean('Contracts');
     $this->javascript->setSugarBean($focus);
     $this->javascript->addAllFields('');
     $status_options = isset($focus->status) ? get_select_options_with_id($app_list_strings['contract_status_dom'], $focus->status) : get_select_options_with_id($app_list_strings['contract_status_dom'], '');
     $this->ss->assign('STATUS_OPTIONS', $status_options);
     $json = getJSONobj();
     $popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'contractsQuickCreate', 'field_to_name_array' => array('id' => 'account_id', 'name' => 'account_name'));
     $encoded_popup_request_data = $json->encode($popup_request_data);
     $this->ss->assign('encoded_popup_request_data', $encoded_popup_request_data);
     $popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'contractsQuickCreate', 'field_to_name_array' => array('id' => 'team_id', 'name' => 'team_name'));
     $this->ss->assign('encoded_team_popup_request_data', $json->encode($popup_request_data));
     $this->ss->assign('additionalScripts', $this->javascript->getScript(false));
 }
Exemple #17
0
 /**
  * display
  * Override the display method to support customization for the buttons that display
  * a popup and allow you to copy the account's address into the selected contacts.
  * The custom_code_billing and custom_code_shipping Smarty variables are found in
  * include/SugarFields/Fields/Address/DetailView.tpl (default).  If it's a English U.S.
  * locale then it'll use file include/SugarFields/Fields/Address/en_us.DetailView.tpl.
  */
 function display()
 {
     global $app_strings, $app_list_strings;
     global $mod_strings;
     parent::display();
     $smarty = new Sugar_Smarty();
     $smarty->assign('APP', $app_strings);
     $smarty->assign('MOD', $mod_strings);
     $smarty->assign('RECORD', $this->bean->id);
     $popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'xeBayOrderSend', 'field_to_name_array' => array('description' => 'message'));
     $json = getJSONobj();
     $smarty->assign('ENCODED_TEMPLATES_POPUP_REQUEST_DATA', $json->encode($popup_request_data));
     $smarty->assign("TEMPLATE_SELECT", SugarThemeRegistry::current()->getImage('id-ff-select', '', null, null, '.png', $mod_strings['LBL_SELECT']));
     $smarty->assign("TEMPLATE_CLEAR", SugarThemeRegistry::current()->getImage('id-ff-clear', '', null, null, '.gif', $mod_strings['LBL_ID_FF_CLEAR']));
     $itemAssociation = '';
     $this->bean->load_relationship('xebaytransactions');
     $transactions = $this->bean->xebaytransactions->getBeans();
     $first = true;
     foreach ($transactions as &$transaction) {
         if (!empty($transaction->item_item_id)) {
             if ($first == true) {
                 $first = false;
                 $smarty->assign('ITEM_ID', $transaction->item_item_id);
                 $smarty->assign('SUBJECT', $transaction->name);
                 $itemAssociation .= "<input name='item_assocaition' id='{$transaction->name}' type='radio' value='{$transaction->item_item_id}' checked='checked' onclick=select_item_id(this) />{$transaction->name}<br>";
             } else {
                 $itemAssociation .= "<input name='item_assocaition' id='{$transaction->name}' type='radio' value='{$transaction->item_item_id}' onclick=select_item_id(this) />{$transaction->name}<br>";
             }
         }
     }
     $smarty->assign('ITEM_ASSOCIATION', $itemAssociation);
     $smarty->assign('SALUTATION', str_replace("\n", "<br>", $this->bean->get_salutation()));
     $smarty->assign('SIGNATURE', str_replace("\n", "<br>", $this->bean->get_signature()));
     $smarty->display("modules/xeBayOrders/tpls/send.tpl");
 }
Exemple #18
0
    function display()
    {
        global $app_list_strings;
        $json = getJSONobj();
        $prob_array = $json->encode($app_list_strings['sales_probability_dom']);
        $prePopProb = '';
        if (empty($this->bean->id) && empty($_REQUEST['probability'])) {
            $prePopProb = 'document.getElementsByName(\'sales_stage\')[0].onchange();';
        }
        $probability_script = <<<EOQ
\t<script>
\tprob_array = {$prob_array};
\tdocument.getElementsByName('sales_stage')[0].onchange = function() {
\t\t\tif(typeof(document.getElementsByName('sales_stage')[0].value) != "undefined" && prob_array[document.getElementsByName('sales_stage')[0].value]
\t\t\t&& typeof(document.getElementsByName('probability')[0]) != "undefined"
\t\t\t) {
\t\t\t\tdocument.getElementsByName('probability')[0].value = prob_array[document.getElementsByName('sales_stage')[0].value];
\t\t\t\tSUGAR.util.callOnChangeListers(document.getElementsByName('probability')[0]);

\t\t\t} 
\t\t};
\t{$prePopProb}
\t</script>
EOQ;
        $this->ss->assign('PROBABILITY_SCRIPT', $probability_script);
        parent::display();
    }
/**
 * Smarty {sugar_evalcolumn_old} function plugin
 *
 * Type:     function<br>
 * Name:     sugar_evalcolumn_old<br>
 * Purpose:  evaluate a string by substituting values in the rowData parameter. Used for ListViews<br>
 * 
 * @author Wayne Pan {wayne at sugarcrm.com
 * @param array
 * @param Smarty
 */
function smarty_function_sugar_evalcolumn_old($params, &$smarty)
{
    if (!isset($params['var']) || !isset($params['rowData'])) {
        if (!isset($params['var'])) {
            $smarty->trigger_error("evalcolumn: missing 'var' parameter");
        }
        if (!isset($params['rowData'])) {
            $smarty->trigger_error("evalcolumn: missing 'rowData' parameter");
        }
        return;
    }
    if ($params['var'] == '') {
        return;
    }
    if (is_array($params['var'])) {
        foreach ($params['var'] as $key => $value) {
            $params['var'][$key] = searchReplace($value, $params['rowData']);
        }
    } else {
        $params['var'] = searchReplace($params['var'], $params['rowData']);
    }
    if (isset($params['toJSON'])) {
        $json = getJSONobj();
        $params['var'] = $json->encode($params['var']);
    }
    if (!empty($params['assign'])) {
        $smarty->assign($params['assign'], $params['var']);
    } else {
        return $params['var'];
    }
}
Exemple #20
0
 public function action_DisplayInlineTeams()
 {
     $this->view = 'ajax';
     $body = '';
     $primary_team_id = isset($_REQUEST['team_id']) ? $_REQUEST['team_id'] : '';
     $caption = '';
     if (!empty($_REQUEST['team_set_id'])) {
         require_once 'modules/Teams/TeamSetManager.php';
         $teams = TeamSetManager::getTeamsFromSet($_REQUEST['team_set_id']);
         foreach ($teams as $row) {
             if ($row['id'] == $primary_team_id) {
                 $body = $row['display_name'] . '*<br/>' . $body;
             } else {
                 $body .= $row['display_name'] . '<br/>';
             }
         }
     }
     global $theme;
     $json = getJSONobj();
     $retArray = array();
     $retArray['body'] = $body;
     $retArray['caption'] = $caption;
     $retArray['width'] = '100';
     $retArray['theme'] = $theme;
     echo 'result = ' . $json->encode($retArray);
 }
function generateFieldDefsJS2()
{
    global $app_list_strings, $beanList, $beanFiles;
    $badFields = array('account_description', 'contact_id', 'lead_id', 'opportunity_amount', 'opportunity_id', 'opportunity_name', 'opportunity_role_id', 'opportunity_role_fields', 'opportunity_role', 'campaign_id', 'id', 'user_preferences', 'accept_status', 'user_hash', 'authenticate_id', 'sugar_login', 'reports_to_id', 'reports_to_name', 'is_admin', 'receive_notifications', 'modified_user_id', 'modified_by_name', 'created_by', 'created_by_name', 'accept_status_id', 'accept_status_name');
    $loopControl = array();
    $prefixes = array();
    foreach ($app_list_strings['moduleList'] as $key => $name) {
        if (isset($beanList[$key]) && isset($beanFiles[$beanList[$key]]) && !str_begin($key, 'AOW_')) {
            require_once $beanFiles[$beanList[$key]];
            $focus = new $beanList[$key]();
            $loopControl[$key][$key] = $focus;
            $prefixes[$key] = strtolower($focus->object_name) . '_';
            if ($focus->object_name == 'Case') {
                $prefixes[$key] = 'a' . strtolower($focus->object_name) . '_';
            }
        }
    }
    $contact = new Contact();
    $lead = new Lead();
    $prospect = new Prospect();
    $loopControl['Contacts'] = array('Contacts' => $contact, 'Leads' => $lead, 'Prospects' => $prospect);
    $prefixes['Users'] = 'contact_user_';
    $collection = array();
    foreach ($loopControl as $collectionKey => $beans) {
        $collection[$collectionKey] = array();
        foreach ($beans as $beankey => $bean) {
            foreach ($bean->field_defs as $key => $field_def) {
                if ($field_def['type'] == 'assigned_user_name' || $field_def['type'] == 'link' || $field_def['type'] == 'bool' || in_array($field_def['name'], $badFields)) {
                    continue;
                }
                if (!isset($field_def['vname'])) {
                    //echo $key;
                }
                // valid def found, process
                $optionKey = strtolower("{$prefixes[$collectionKey]}{$key}");
                if (isset($field_def['vname'])) {
                    $optionLabel = preg_replace('/:$/', "", translate($field_def['vname'], $beankey));
                } else {
                    $optionLabel = preg_replace('/:$/', "", $field_def['name']);
                }
                $dup = 1;
                foreach ($collection[$collectionKey] as $value) {
                    if ($value['name'] == $optionKey) {
                        $dup = 0;
                        break;
                    }
                }
                if ($dup) {
                    $collection[$collectionKey][] = array("name" => $optionKey, "value" => $optionLabel);
                }
            }
        }
    }
    $json = getJSONobj();
    $ret = "var field_defs = ";
    $ret .= $json->encode($collection, false);
    $ret .= ";";
    return $ret;
}
Exemple #22
0
 public function action_search()
 {
     //set ajax view
     $this->view = 'ajax';
     //get the module
     $module = !empty($_REQUEST['qModule']) ? $_REQUEST['qModule'] : '';
     //lowercase module name
     $lmodule = strtolower($module);
     //get the search term
     $term = !empty($_REQUEST['term']) ? $GLOBALS['db']->quote($_REQUEST['term']) : '';
     //in the case of Campaigns we need to use the related module
     $relModule = !empty($_REQUEST['rel_module']) ? $_REQUEST['rel_module'] : null;
     $max = !empty($_REQUEST['max']) ? $_REQUEST['max'] : 10;
     $order_by = !empty($_REQUEST['order_by']) ? $_REQUEST['order_by'] : $lmodule . ".name";
     $offset = !empty($_REQUEST['offset']) ? $_REQUEST['offset'] : 0;
     $response = array();
     if (!empty($module)) {
         $where = '';
         $deleted = '0';
         $using_cp = false;
         if (!empty($term)) {
             if ($module == 'Contacts' || $module == 'Leads') {
                 $where = $lmodule . ".first_name like '%" . $term . "%' OR " . $lmodule . ".last_name like '%" . $term . "%'";
                 $order_by = $lmodule . ".last_name";
             } else {
                 $where = $lmodule . ".name like '" . $term . "%'";
             }
         }
         if ($module == 'CampaignProspects') {
             $using_cp = true;
             $module = 'Prospects';
             $lmodule = strtolower($relModule);
             $campign_where = $_SESSION['MAILMERGE_WHERE'];
             $where = $lmodule . ".first_name like '%" . $term . "%' OR " . $lmodule . ".last_name like '%" . $term . "%'";
             if ($campign_where) {
                 $where .= " AND " . $campign_where;
             }
             $where .= " AND related_type = #" . $lmodule . "#";
         }
         $seed = BeanFactory::getBean($module);
         if ($using_cp) {
             $fields = array('id', 'first_name', 'last_name');
             $dataList = $seed->retrieveTargetList($where, $fields, $offset, -1, $max, $deleted);
         } else {
             $dataList = $seed->get_list($order_by, $where, $offset, -1, $max, $deleted);
         }
         $list = $dataList['list'];
         $row_count = $dataList['row_count'];
         $output_list = array();
         foreach ($list as $value) {
             $output_list[] = get_return_value($value, $module);
         }
         $response['result'] = array('result_count' => $row_count, 'entry_list' => $output_list);
     }
     $json = getJSONobj();
     $json_response = $json->encode($response, true);
     print $json_response;
 }
 function process()
 {
     global $current_user, $timedate, $app_list_strings, $current_language, $mod_strings;
     $mod_strings = return_module_language($current_language, 'ProductComponents');
     $format = new Format();
     parent::process();
     if ($this->viaAJAX) {
         // override for ajax call
         $this->ss->assign('saveOnclick', "onclick='if(check_form(\"productComponentsQuickCreate\")) return SUGAR.subpanelUtils.inlineSave(this.form.id, \"productcomponents\"); else return false;'");
         $this->ss->assign('cancelOnclick', "onclick='return SUGAR.subpanelUtils.cancelCreate(\"subpanel_productcomponents\")';");
     }
     $this->ss->assign('viaAJAX', $this->viaAJAX);
     $this->javascript = new javascript();
     $this->javascript->setFormName('productComponentsQuickCreate');
     $focus = new ProductComponents();
     $this->javascript->setSugarBean($focus);
     $this->javascript->addAllFields('');
     $app_list_strings['products_format_options'] = $format->Get_Dropdown_Data();
     $this->ss->assign('additionalScripts', $this->javascript->getScript(false));
     $this->ss->assign('run_style_options', get_select_options_with_id($app_list_strings['layout_type_options'], ''));
     $this->ss->assign('type_options', get_select_options_with_id($app_list_strings['type_options'], $focus->type));
     $this->ss->assign('color_side_a', get_select_options_with_id($app_list_strings['color_side_a'], $focus->color_side_a));
     $this->ss->assign('color_side_b', get_select_options_with_id($app_list_strings['color_side_b'], $focus->color_side_b));
     $this->ss->assign("STATUS_OPTIONS", get_select_options_with_id($app_list_strings['project_task_status_options'], $focus->status));
     $this->ss->assign("FORMAT_OPTIONS", get_select_options_with_id($app_list_strings['products_format_options'], $focus->format));
     $this->ss->assign("RUN_FORMAT_OPTIONS", get_select_options_with_id($app_list_strings['products_format_options'], $focus->format));
     $this->ss->assign("BLEED_FORMAT_OPTIONS", get_select_options_with_id($app_list_strings['products_format_options'], $focus->format));
     $ppref = 'PRD';
     $pnumber = $focus->get_pnum();
     $number_suf = $focus->generate_number();
     $this->ss->assign('number_pref', $ppref);
     $this->ss->assign('pnum', $pnumber);
     $this->ss->assign('number_suf', $number_suf);
     $this->ss->assign("LAYOUTROWS", $focus->getLayoutRow(new Layoutline(), 0, true, true));
     //$this->ss->parse("main.row1");
     $json = getJSONobj();
     ///////////////////////////////////////
     ///
     /// SETUP PARENT POPUP
     $popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'projectTypeQuickCreate', 'field_to_name_array' => array('id' => 'parent_id', 'name' => 'parent_name'));
     $encoded_parent_popup_request_data = $json->encode($popup_request_data);
     $this->ss->assign('encoded_parent_popup_request_data', $encoded_parent_popup_request_data);
     $popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'productComponentsQuickCreate', 'field_to_name_array' => array('id' => 'paperid', 'pname' => 'paper'));
     $this->ss->assign('encoded_paper_popup_request_data', $json->encode($popup_request_data));
     //machines popup
     /*	$popup_request_data = array(
     			'call_back_function' => 'set_return',
     			'form_name' => 'productComponentsQuickCreate',
     			'field_to_name_array' => array(
     				'id' => 'machine_id',
     				'name' => 'machine',
     			),
     		);
     	
     		$encoded_popup_request_data = $json->encode($popup_request_data);
     		$this->ss->assign('encoded_machine_popup_request_data', $encoded_popup_request_data);        
     		*/
 }
Exemple #24
0
 function display()
 {
     global $current_language;
     $this->ev->process();
     $this->ss->assign('CURRENT_LANG', substr($current_language, 0, 2));
     $json = getJSONobj();
     $this->ss->assign('field_name_exceptions', $json->encode(Reports_Utils::getNameException()));
     echo $this->ev->display();
 }
Exemple #25
0
	function display(){
		error_reporting(0);
		require_once('include/json_config.php');
		global $json;
        	$json = getJSONobj();
        	$json_config = new json_config();
        	$GRjavascript = $json_config->getFocusData($_REQUEST['type'], $_REQUEST['record']);
        	ob_clean();
        	echo $GRjavascript;
	}
/**
 * Smarty {sugar_evalcolumn} function plugin
 *
 * Type:     function<br>
 * Name:     sugar_evalcolumn<br>
 * Purpose:  evaluate a string by substituting values in the rowData parameter. Used for ListViews<br>
 * 
 * @author Wayne Pan {wayne at sugarcrm.com
 * @param array
 * @param Smarty
 */
function smarty_function_sugar_evalcolumn($params, &$smarty)
{
    if (!isset($params['colData']['field'])) {
        if (empty($params['colData'])) {
            $smarty->trigger_error("evalcolumn: missing 'colData' parameter");
        }
        if (!isset($params['colData']['field'])) {
            $smarty->trigger_error("evalcolumn: missing 'colData.field' parameter");
        }
        return;
    }
    if (empty($params['colData']['field'])) {
        return;
    }
    $params['var'] = $params['colData']['field'];
    if (isset($params['toJSON'])) {
        $json = getJSONobj();
        $params['var'] = $json->encode($params['var']);
    }
    if (!empty($params['var']['assign'])) {
        return '{$' . $params['colData']['field']['name'] . '}';
    } else {
        $code = $params['var']['customCode'];
        if (isset($params['tabindex']) && preg_match_all("'(<[ ]*?)(textarea|input|select)([^>]*?)(>)'si", $code, $matches, PREG_PATTERN_ORDER)) {
            $str_replace = array();
            $tabindex = ' tabindex="' . $params['tabindex'] . '" ';
            foreach ($matches[3] as $match) {
                $str_replace[$match] = $tabindex . $match;
            }
            $code = str_replace(array_keys($str_replace), array_values($str_replace), $code);
        }
        // Add a string replace to swap out @@FIELD@@ for the actual field,
        // we can't do this through customCode directly because the sugar_field smarty function returns smarty code to run on the second pass
        if (!empty($code) && strpos($code, '@@FIELD@@') !== FALSE) {
            // First we need to fetch extra data about the field
            // sfp == SugarFieldParams
            $sfp = $params;
            $sfp['parentFieldArray'] = 'fields';
            $vardefs = $smarty->get_template_vars('fields');
            $sfp['vardef'] = $vardefs[$params['colData']['field']['name']];
            $sfp['displayType'] = 'EditView';
            $sfp['displayParams'] = $params['colData']['field']['displayParams'];
            $sfp['typeOverride'] = $params['colData']['field']['type'];
            $sfp['formName'] = $smarty->get_template_vars('form_name');
            $fieldText = smarty_function_sugar_field($sfp, $smarty);
            $code = str_replace('@@FIELD@@', $fieldText, $code);
        }
        //eggsurplus bug 28321: add support for rendering customCode AND normal field rendering
        if (!empty($params['var']['displayParams']['enableConnectors']) && empty($params['var']['customCodeRenderField'])) {
            require_once 'include/connectors/utils/ConnectorUtils.php';
            $code .= '&nbsp;' . ConnectorUtils::getConnectorButtonScript($params['var']['displayParams'], $smarty);
        }
        return $code;
    }
}
Exemple #27
0
 function display()
 {
     $root = new ExtNode('root', 'root', true);
     $sb = new StudioBrowser();
     $sb->loadModules();
     foreach ($sb->modules as $name => $studioMod) {
         $root->add_node($this->buildStudioNode($studioMod));
     }
     $json = getJSONobj();
     echo $json->encode($root);
 }
 function getAssignedUser()
 {
     $json_obj = getJSONobj();
     $report_def_str = $json_obj->decode($this->reporter->report_def_str);
     if (empty($report_def_str['assigned_user_id'])) {
         return null;
     }
     $this->assigned_user = new User();
     $this->assigned_user->retrieve($report_def_str['assigned_user_id']);
     return $this->assigned_user;
 }
 function display()
 {
     $source_id = $_REQUEST['source_id'];
     if (empty($source_id)) {
         $GLOBALS['log']->error($GLOBALS['mod_strings']['ERROR_EMPTY_SOURCE_ID']);
         echo $GLOBALS['mod_strings']['ERROR_EMPTY_SOURCE'];
         return;
     }
     $record_id = $_REQUEST['record'];
     if (empty($record_id)) {
         $GLOBALS['log']->error($GLOBALS['mod_strings']['ERROR_EMPTY_RECORD_ID']);
         echo $GLOBALS['mod_strings']['ERROR_EMPTY_RECORD_ID'];
         return;
     }
     $merge_module = $_SESSION['merge_module'];
     if (empty($_SESSION['searchDefs'][$merge_module][$record_id][$source_id])) {
         $GLOBALS['log']->error("ERROR_NO_SEARCHDEFS_MAPPING");
         echo $GLOBALS['mod_strings']['ERROR_NO_SEARCHDEFS_MAPPING'];
         return;
     }
     $args = $_SESSION['searchDefs'][$merge_module][$record_id][$source_id];
     $source_instance = ConnectorFactory::getInstance($source_id);
     try {
         $beans = $source_instance->fillBeans($args, $merge_module);
     } catch (Exception $ex) {
         echo $ex->getMessage();
         return;
     }
     if (empty($beans)) {
         echo '<br>' . $GLOBALS['mod_strings']['LBL_EMPTY_BEANS'];
         return;
     }
     $json = getJSONobj();
     $json_data = array();
     foreach ($beans as $id => $record) {
         $json_data[$id] = $json->encode($record->get_list_view_array());
     }
     $this->ss->assign('source_id', $source_id);
     $this->ss->assign('json_data', $json_data);
     $this->ss->assign('DATA', $beans);
     //Setup listview to display
     $lv = new ListViewSmarty();
     if (is_array($beans)) {
         $displayColumns = $this->getDisplayColumns($source_instance, $beans);
         $this->ss->assign('displayColumns', $displayColumns);
         global $odd_bg, $even_bg, $hilite_bg, $click_bg;
         $this->ss->assign('bgHilite', $hilite_bg);
         $this->ss->assign('rowColor', array('oddListRow', 'evenListRow'));
         $this->ss->assign('bgColor', array($odd_bg, $even_bg));
         $this->ss->assign('module', $merge_module);
         echo $this->ss->fetch($this->getCustomFilePathIfExists('modules/Connectors/tpls/listview.tpl'));
     }
 }
Exemple #30
-1
 /**
  * Displays the dashlet
  *
  * @return string html to display dashlet
  */
 function display()
 {
     require_once "modules/Reports/Report.php";
     $chartReport = BeanFactory::getBean('Reports', $this->report_id, array('encode' => false, 'strict_retrieve' => true));
     if (!empty($chartReport)) {
         $title = getReportNameTranslation($chartReport->name);
         $this->title = $title;
         $reporter = new Report($chartReport->content);
         $reporter->is_saved_report = true;
         $reporter->saved_report_id = $chartReport->id;
         $reporter->get_total_header_row();
         $reporter->run_chart_queries();
         ob_start();
         require_once "include/SugarCharts/ChartDisplay.php";
         $chartDisplay = new ChartDisplay();
         $chartDisplay->setReporter($reporter);
         echo $chartDisplay->legacyDisplay($this->id, true);
         $str = ob_get_contents();
         ob_end_clean();
         $xmlFile = $chartDisplay->get_cache_file_name($reporter);
         $html = parent::display() . "<div align='center'>" . $str . "</div>" . "<br />";
         // return parent::display for title and such
         $ss = new Sugar_Smarty();
         $ss->assign('chartName', $this->id);
         $ss->assign('chartXMLFile', $xmlFile);
         $script = $ss->fetch('modules/Home/Dashlets/ChartsDashlet/ChartsDashletScript.tpl');
         $json = getJSONobj();
         return parent::display() . "<div align='center'>" . $str . "</div>" . "<br />";
         // return parent::display for title and such
     }
 }