示例#1
0
 /**
  *
  */
 function process_page()
 {
     global $theme;
     global $mod_strings;
     global $app_strings;
     global $currentModule;
     global $sugar_version, $sugar_config;
     $output_html = '';
     $where = '';
     $where = $this->_get_where_clause();
     $first_name = empty($_REQUEST['first_name']) ? '' : $_REQUEST['first_name'];
     $last_name = empty($_REQUEST['last_name']) ? '' : $_REQUEST['last_name'];
     $user_name = empty($_REQUEST['user_name']) ? '' : $_REQUEST['user_name'];
     $request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data'];
     $hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true;
     $button = "<form action='index.php' method='post' name='form' id='form'>\n";
     if (!$hide_clear_button) {
         $button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='" . $app_strings['LBL_CLEAR_BUTTON_TITLE'] . "'  />\n";
     }
     $button .= "<input type='submit' name='button' class='button' onclick=\"window.close();\" title='" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_CANCEL_BUTTON_KEY'] . "' value='  " . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . "  ' />\n";
     $button .= "</form>\n";
     $form = new XTemplate('modules/Employees/Popup_picker.html');
     $form->assign('MOD', $mod_strings);
     $form->assign('APP', $app_strings);
     $form->assign('THEME', $theme);
     $form->assign('MODULE_NAME', $currentModule);
     $form->assign('FIRST_NAME', $first_name);
     $form->assign('LAST_NAME', $last_name);
     $form->assign('USER_NAME', $user_name);
     $form->assign('request_data', $request_data);
     ob_start();
     insert_popup_header($theme);
     $output_html .= ob_get_contents();
     ob_end_clean();
     $output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false);
     $form->parse('main.SearchHeader');
     $output_html .= $form->text('main.SearchHeader');
     // Reset the sections that are already in the page so that they do not print again later.
     $form->reset('main.SearchHeader');
     // create the listview
     $seed_bean = BeanFactory::getBean('Employees');
     $ListView = new ListView();
     $ListView->show_export_button = false;
     $ListView->process_for_popups = true;
     $ListView->setXTemplate($form);
     $ListView->setHeaderTitle($mod_strings['LBL_LIST_FORM_TITLE']);
     $ListView->setHeaderText($button);
     $ListView->setQuery($where, '', 'user_name', 'EMPLOYEE');
     $ListView->setModStrings($mod_strings);
     ob_start();
     $ListView->processListView($seed_bean, 'main', 'EMPLOYEE');
     $output_html .= ob_get_contents();
     ob_end_clean();
     $output_html .= insert_popup_footer();
     return $output_html;
 }
 function buildTableForm($rows, $mod = '')
 {
     global $odd_bg, $even_bg;
     if (!empty($mod)) {
         global $current_language;
         $mod_strings = return_module_language($current_language, $mod);
     } else {
         global $mod_strings;
     }
     global $app_strings;
     $cols = sizeof($rows[0]) * 2 + 1;
     $form = '<table width="100%"><tr><td>' . $mod_strings['MSG_DUPLICATE'] . '</td></tr><tr><td height="20"></td></tr></table>';
     $form .= "<form action='index.php' method='post' name='dupFeed'><input type='hidden' name='selectedFeed' value=''>";
     $form .= get_form_header($mod_strings['LBL_DUPLICATE'], "", '');
     $form .= "<table width='100%' cellpadding='0' cellspacing='0'>\t<tr class='listViewThS1'>\t<td class='listViewThS1'> &nbsp;</td>";
     require_once 'include/formbase.php';
     $form .= getPostToForm();
     if (isset($rows[0])) {
         foreach ($rows[0] as $key => $value) {
             if ($key != 'id') {
                 $form .= "<td scope='col' class='listViewThS1'>" . $mod_strings[$mod_strings['db_' . $key]] . "</td>";
             }
         }
         $form .= "</tr>";
     }
     $bgcolor = $odd_bg;
     $rowColor = 'oddListRowS1';
     foreach ($rows as $row) {
         $form .= "<tr class='{$rowColor}' bgcolor='{$bgcolor}'>";
         $form .= "<td width='1%' bgcolor='{$bgcolor}' nowrap ><a href='#' onClick=\"document.dupFeeds.selectedFeed.value='{$row['id']}';document.dupFeeds.submit() \">[{$app_strings['LBL_SELECT_BUTTON_LABEL']}]</a>&nbsp;&nbsp;</td>";
         $wasSet = false;
         foreach ($row as $key => $value) {
             if ($key != 'id') {
                 if (!$wasSet) {
                     $form .= "<td scope='row' class='{$rowColor}' bgcolor='{$bgcolor}'><a target='_blank' href='index.php?module=Feeds&action=DetailView&record={$row['id']}'>{$value}</a></td>";
                     $wasSet = true;
                 } else {
                     $form .= "<td class='{$rowColor}' bgcolor='{$bgcolor}'><a target='_blank' href='index.php?module=Feeds&action=DetailView&record={$row['id']}'>{$value}</a></td>";
                 }
             }
         }
         if ($rowColor == 'evenListRowS1') {
             $rowColor = 'oddListRowS1';
             $bgcolor = $odd_bg;
         } else {
             $rowColor = 'evenListRowS1';
             $bgcolor = $even_bg;
         }
         $form .= "</tr>";
     }
     $form .= "<tr class='listViewThS1'><td colspan='{$cols}' class='blackline'></td></tr>";
     $form .= "</table><br><input type='submit' class='button' name='ContinueFeed' value='{$app_strings['LBL_CREATE_BUTTON_LABEL']} {$mod_strings['LNK_NEW_CONTACT']}'></form>";
     return $form;
 }
示例#3
0
 /**
  * display the form
  */
 public function display()
 {
     global $db, $timedate, $current_language;
     parent::display();
     $index = BeanFactory::getBean("AOD_Index");
     $index = $index->getIndex();
     $beanList = $index->getIndexableModules();
     $moduleCounts = array();
     foreach ($beanList as $beanModule => $beanName) {
         $bean = BeanFactory::getBean($beanModule);
         if (!$bean || !method_exists($bean, "getTableName") || !$bean->getTableName()) {
             continue;
         }
         $query = "SELECT COUNT(DISTINCT b.id) FROM " . $bean->getTableName() . " b WHERE b.deleted = 0";
         $moduleCounts[$beanModule] = $db->getOne($query);
     }
     $revisionCount = array_sum($moduleCounts);
     $indexedCount = $db->getOne("SELECT COUNT(*) FROM aod_indexevent WHERE deleted = 0 AND success = 1");
     $failedCount = $db->getOne("SELECT COUNT(*) FROM aod_indexevent WHERE deleted = 0 AND success = 0");
     $indexFiles = count(glob($index->location . "/*.cfs"));
     $this->ss->assign("revisionCount", $revisionCount);
     $this->ss->assign("indexedCount", $indexedCount);
     $this->ss->assign("failedCount", $failedCount);
     $this->ss->assign("index", $index);
     $this->ss->assign("indexFiles", $indexFiles);
     echo $this->ss->fetch('modules/AOD_Index/tpls/indexdata.tpl');
     if ($failedCount) {
         $seed = BeanFactory::newBean("AOD_IndexEvent");
         $lv = new ListViewSmarty();
         $lv->lvd->additionalDetails = false;
         $mod_strings = return_module_language($current_language, $seed->module_dir);
         require 'modules/' . $seed->module_dir . '/metadata/listviewdefs.php';
         if (file_exists('custom/modules/' . $seed->module_dir . '/metadata/listviewdefs.php')) {
             require 'custom/modules/' . $seed->module_dir . '/metadata/listviewdefs.php';
         }
         $lv->displayColumns = $listViewDefs[$seed->module_dir];
         $lv->quickViewLinks = false;
         $lv->export = false;
         $lv->mergeduplicates = false;
         $lv->multiSelect = false;
         $lv->delete = false;
         $lv->select = false;
         $lv->showMassupdateFields = false;
         $lv->email = false;
         $lv->setup($seed, 'include/ListView/ListViewNoMassUpdate.tpl', 'success = 0', '', 0, 10);
         echo '<br /><br />' . get_form_header($GLOBALS['mod_strings']['LBL_FAILED_RECORDS'] . ' (' . $lv->data['pageData']['offsets']['total'] . ')', '', false);
         if ($lv->data['pageData']['offsets']['total'] == 0) {
             echo "No data";
         } else {
             echo $lv->display();
         }
     }
 }
示例#4
0
 function listViewProcess()
 {
     $this->processSearchForm();
     $this->lv->searchColumns = $this->searchForm->searchColumns;
     if (!$this->headers) {
         return;
     }
     if (empty($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] == false) {
         $this->lv->setup($this->seed, 'include/ListView/ListViewGeneric.tpl', $this->where, $this->params);
         $savedSearchName = empty($_REQUEST['saved_search_select_name']) ? '' : ' - ' . $_REQUEST['saved_search_select_name'];
         echo get_form_header($GLOBALS['mod_strings']['LBL_LIST_FORM_TITLE'] . $savedSearchName, '', false);
         echo $this->lv->display();
     }
 }
 public function testget_form_header()
 {
     error_reporting(E_ERROR | E_PARSE);
     //execute the method and test if it returns html and contains the values provided in parameters
     //help param true
     $html1 = get_form_header('test Header', 'test subheader', true);
     $this->assertGreaterThan(0, strlen($html1));
     $this->assertContains('test Header', $html1);
     $this->assertContains('test subheader', $html1);
     // help param false
     $html2 = get_form_header('new test Header', 'new test subheader', false);
     $this->assertGreaterThan(0, strlen($html2));
     $this->assertContains('new test Header', $html2);
     $this->assertContains('new test subheader', $html2);
     $this->assertGreaterThan(strlen($html2), strlen($html1));
 }
示例#6
0
 function buildTableForm($rows, $mod = 'Quotes')
 {
     if (!ACLController::checkAccess('Quotes', 'edit', true)) {
         return '';
     }
     if (!empty($mod)) {
         global $current_language;
         $mod_strings = return_module_language($current_language, $mod);
     } else {
         global $mod_strings;
     }
     global $app_strings;
     $cols = sizeof($rows[0]) * 2 + 1;
     $form = '<table width="100%"><tr><td>' . $mod_strings['MSG_DUPLICATE'] . '</td></tr><tr><td height="20"></td></tr></table>';
     $form .= "<form action='index.php' method='post' name='dupOpps'><input type='hidden' name='selectedQuote' value=''>";
     $form .= get_form_header($mod_strings['LBL_DUPLICATE'], "", '');
     $form .= "<table width='100%' cellpadding='0' cellspacing='0'>\t<tr >\t<td ></TD>";
     require_once 'include/formbase.php';
     $form .= getPostToForm();
     if (isset($rows[0])) {
         foreach ($rows[0] as $key => $value) {
             if ($key != 'id') {
                 $form .= "<td >" . $mod_strings[$mod_strings['db_' . $key]] . "</td>";
             }
         }
         $form .= "</tr>";
     }
     $rowColor = 'oddListRowS1';
     foreach ($rows as $row) {
         $form .= "<tr class='{$rowColor}'><td width='1%' nowrap='nowrap'><a href='#' onclick='document.dupOpps.selectedQuote.value=\"{$row['id']}\";document.dupOpps.submit();'>[{$app_strings['LBL_SELECT_BUTTON_LABEL']}]</a>&nbsp;&nbsp;</td>";
         foreach ($row as $key => $value) {
             if ($key != 'id') {
                 $form .= "<td><a target='_blank' href='index.php?module=Quotes&action=DetailView&record={$row['id']}'>{$value}</a></td>";
             }
         }
         if ($rowColor == 'evenListRowS1') {
             $rowColor = 'oddListRowS1';
         } else {
             $rowColor = 'evenListRowS1';
         }
         $form .= "</tr>";
     }
     $form .= "<tr ><td colspan='{$cols}' class='blackline'></td></tr>";
     $form .= "</table><BR><input type='submit' class='button' name='ContinueQuote' value='{$app_strings['LBL_CREATE_BUTTON_LABEL']} {$mod_strings['LNK_NEW_QUOTE']}'></form>";
     return $form;
 }
示例#7
0
 function listViewProcess()
 {
     $this->processSearchForm();
     $this->lv->searchColumns = $this->searchForm->searchColumns;
     if (!$this->headers) {
         return;
     }
     if (empty($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] == false) {
         $this->lv->setup($this->seed, 'modules/Contracts/tpls/ListViewGeneric.tpl', $this->where, $this->params);
         $savedSearchName = empty($_REQUEST['saved_search_select_name']) ? '' : ' - ' . $_REQUEST['saved_search_select_name'];
         echo get_form_header($GLOBALS['mod_strings']['LBL_LIST_FORM_TITLE'] . $savedSearchName, '', false);
         /**
          * added by Hoc Bui
          *
          * @var OpportunitiesViewList
          */
         $filter_fields = array();
         $orderBy = "";
         $ret_array = $this->seed->create_new_list_query($orderBy, $this->where, $filter_fields, $this->params, 0, '', true, $this->seed, true);
         $main_query = $ret_array['select'] . $params['custom_select'] . $ret_array['from'] . $params['custom_from'] . $ret_array['inner_join'] . $ret_array['where'] . $params['custom_where'] . $ret_array['order_by'] . $params['custom_order_by'];
         //print_r($ret_array);
         //exit;
         /*$query = "SELECT amount_usdollar,amount, deleted FROM opportunities " ;
           if($this->where)
           $query .= "WHERE ".$this->where;*/
         global $db;
         $result = $db->query($main_query);
         $i = 0;
         $total = 0;
         while (($row = $db->fetchByAssoc($result)) != null) {
             if ($row['deleted'] != 1) {
                 $total += $row['tongtien'];
             }
             $i++;
         }
         // $this->lv->ss->assign("total", currency_format_number($GLOBALS['ESCOppAmount'])) ;
         $this->lv->ss->assign("total", currency_format_number($total));
         /**
          * end Hoc Bui
          *
          * @var OpportunitiesViewList
          */
         echo $this->lv->display();
         //echo currency_format_number($GLOBALS['ESCOppAmount']);
     }
 }
 /**
  *
  */
 function process_page()
 {
     global $theme;
     global $mod_strings;
     global $app_strings;
     global $currentModule;
     global $image_path;
     $output_html = '';
     $where = '';
     $where = $this->_get_where_clause();
     $name = empty($_REQUEST['name']) ? '' : $_REQUEST['name'];
     $request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data'];
     $hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true;
     $button = '';
     $form = new XTemplate('modules/ACLRoles/ListView.html');
     $form->assign('MOD', $mod_strings);
     $form->assign('APP', $app_strings);
     $form->assign('THEME', $theme);
     $form->assign('MODULE_NAME', $currentModule);
     $form->assign('NAME', $name);
     $form->assign('request_data', $request_data);
     $output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false);
     $form->parse('main.SearchHeader');
     $output_html .= $form->text('main.SearchHeader');
     $output_html .= get_form_footer();
     // Reset the sections that are already in the page so that they do not print again later.
     $form->reset('main.SearchHeader');
     // create the listview
     $seed_bean = new ACLRole();
     $ListView = new ListView();
     $ListView->show_export_button = false;
     $ListView->process_for_popups = true;
     $ListView->setXTemplate($form);
     $ListView->setHeaderTitle($mod_strings['LBL_ROLE']);
     $ListView->setHeaderText($button);
     $ListView->setQuery($where, '', 'name', 'ROLE');
     $ListView->setModStrings($mod_strings);
     ob_start();
     $ListView->processListView($seed_bean, 'main', 'ROLE');
     $output_html .= ob_get_contents();
     ob_end_clean();
     $output_html .= get_form_footer();
     $output_html .= insert_popup_footer();
     return $output_html;
 }
 function listViewProcess()
 {
     $this->processSearchForm();
     $this->lv->searchColumns = $this->searchForm->searchColumns;
     if ($this->where != "") {
         $this->where .= ' and oqc_externalcontract.is_latest !=0';
     } else {
         $this->where .= 'oqc_externalcontract.is_latest !=0';
     }
     if (!$this->headers) {
         return;
     }
     global $sugar_version;
     if (empty($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] == false) {
         if (0 < strpos($this->where, 'oqc_externalcontract.name like') && FALSE === strpos($this->where, 'oqc_externalcontract.description like')) {
             // if someone searched for a title and entered no description to search for, we will expand the sql statement to make sure name and description of contract are searched automatically.
             $this->where = preg_replace('/oqc_externalcontract.name like \'(.*?)\'/', 'oqc_externalcontract.name like \'\\1\' or oqc_externalcontract.description like \'\\1\'', $this->where);
         }
         // search for contracts ending not later than enddate
         if (isset($_REQUEST['searchFormTab']) && $_REQUEST['searchFormTab'] == 'basic_search') {
             $this->where = preg_replace('/oqc_externalcontract.enddate >=/', 'oqc_externalcontract.enddate <=', $this->where);
         }
         if (floatval(substr($sugar_version, 0, 3)) > 6.4) {
             $this->lv->setup($this->seed, 'modules/oqc_ExternalContract/views/ListView65.tpl', $this->where, $this->params);
         } elseif (floatval(substr($sugar_version, 0, 3)) > 6.3) {
             $this->lv->setup($this->seed, 'modules/oqc_ExternalContract/views/ListView64.tpl', $this->where, $this->params);
         } elseif (floatval(substr($sugar_version, 0, 3)) >= 6.0 && floatval(substr($sugar_version, 0, 3)) <= 6.3) {
             $this->lv->setup($this->seed, 'modules/oqc_ExternalContract/views/ListView.tpl', $this->where, $this->params);
         } else {
             $this->lv->setup($this->seed, 'modules/oqc_ExternalContract/views/ListView52.tpl', $this->where, $this->params);
         }
         $savedSearchName = empty($_REQUEST['saved_search_select_name']) ? '' : ' - ' . $_REQUEST['saved_search_select_name'];
         echo get_form_header($GLOBALS['mod_strings']['LBL_LIST_FORM_TITLE'] . $savedSearchName, '', false);
         echo $this->lv->display();
     }
 }
    if (count($where_clauses) > 0) {
        $where = implode(' and ', $where_clauses);
    }
    $GLOBALS['log']->info("Here is the where clause for the list view: {$where}");
}
// start display
// which tab of search form to display
if (!isset($_REQUEST['search_form']) || $_REQUEST['search_form'] != 'false') {
    $searchForm->setup();
    if (isset($_REQUEST['searchFormTab']) && $_REQUEST['searchFormTab'] == 'advanced_search') {
        $searchForm->displayAdvanced();
    } elseif (isset($_REQUEST['searchFormTab']) && $_REQUEST['searchFormTab'] == 'saved_views') {
        $searchForm->displaySavedViews($listViewDefs, $lv);
    } else {
        $searchForm->displayBasic();
    }
}
echo $qsd->GetQSScripts();
$lv->setup($seedProducts, 'include/ListView/ListViewGeneric.tpl', $where, $params);
$savedSearchName = empty($_REQUEST['saved_search_select_name']) ? '' : ' - ' . $_REQUEST['saved_search_select_name'];
echo get_form_header($current_module_strings['LBL_LIST_FORM_TITLE'] . $savedSearchName, '', false);
echo $lv->display();
$savedSearch = new SavedSearch();
$json = getJSONobj();
// fills in saved views select box on shortcut menu
$savedSearchSelects = $json->encode(array($GLOBALS['app_strings']['LBL_SAVED_SEARCH_SHORTCUT'] . '<br>' . $savedSearch->getSelect('Products')));
$str = "<script>\nYAHOO.util.Event.addListener(window, 'load', SUGAR.util.fillShortcuts, {$savedSearchSelects});\n</script>";
echo $str;
?>

    function draw($extra_tools)
    {
        global $app_list_strings, $current_language, $sugar_config, $currentModule, $action, $theme;
        $current_module_strings = return_module_language($current_language, 'Charts');
        if (isset($_REQUEST['obm_refresh'])) {
            $refresh = $_REQUEST['obm_refresh'];
        } else {
            $refresh = false;
        }
        $date_start = array();
        $datax = array();
        //get the dates to display
        global $current_user;
        $user_date_start = $current_user->getPreference('obm_date_start');
        if (!empty($user_date_start) && !isset($_REQUEST['obm_date_start'])) {
            $date_start = $user_date_start;
            Log::debug("USER PREFERENCES['obm_date_start'] is:");
            Log::debug($user_date_start);
        } elseif (isset($_REQUEST['obm_year']) && $_REQUEST['obm_year'] != '') {
            $date_start = $_REQUEST['obm_year'] . '-01-01';
            $current_user->setPreference('obm_date_start', $date_start);
            Log::debug("_REQUEST['obm_date_start'] is:");
            Log::debug($_REQUEST['obm_date_start']);
            Log::debug("_SESSION['obm_date_start'] is:");
            Log::debug($current_user->getPreference('obm_date_start'));
        } else {
            $date_start = date('Y') . '-01-01';
        }
        $user_date_end = $current_user->getPreference('obm_date_end');
        if (!empty($user_date_end) && !isset($_REQUEST['obm_date_end'])) {
            $date_end = $user_date_end;
            Log::debug("USER PREFERENCES['obm_date_end'] is:");
            Log::debug($date_end);
        } elseif (isset($_REQUEST['obm_year']) && $_REQUEST['obm_year'] != '') {
            $date_end = $_REQUEST['obm_year'] . '-12-31';
            $current_user->setPreference('obm_date_end', $date_end);
            Log::debug("_REQUEST['obm_date_end'] is:");
            Log::debug($_REQUEST['obm_date_end']);
            Log::debug("USER PREFERENCES['obm_date_end'] is:");
            Log::debug($current_user->getPreference('obm_date_end'));
        } else {
            $date_end = date('Y') . '-12-31';
        }
        $ids = array();
        //get list of user ids for which to display data
        $user_ids = $current_user->getPreference('obm_ids');
        if (!empty($user_ids) && count($user_ids) != 0 && !isset($_REQUEST['obm_ids'])) {
            $ids = $user_ids;
            Log::debug("USER PREFERENCES['obm_ids'] is:");
            Log::debug($user_ids);
        } elseif (isset($_REQUEST['obm_ids']) && count($_REQUEST['obm_ids']) > 0) {
            $ids = $_REQUEST['obm_ids'];
            $current_user->setPreference('obm_ids', $_REQUEST['obm_ids']);
            Log::debug("_REQUEST['obm_ids'] is:");
            Log::debug($_REQUEST['obm_ids']);
            Log::debug("USER PREFRENCES['obm_ids'] is:");
            Log::debug($current_user->getPreference('obm_ids'));
        } else {
            $ids = get_user_array(false);
            $ids = array_keys($ids);
        }
        //create unique prefix based on selected users for image files
        $id_hash = '1';
        if (isset($ids)) {
            sort($ids);
            $id_hash = crc32(implode('', $ids));
            if ($id_hash < 0) {
                $id_hash = $id_hash * -1;
            }
        }
        Log::debug("ids is:");
        Log::debug($ids);
        $id_md5 = substr(md5($current_user->id), 0, 9);
        // cn: format date_start|end to user's preferred
        global $timedate;
        $dateDisplayStart = strftime($timedate->get_user_date_format(), strtotime($date_start));
        $dateDisplayEnd = strftime($timedate->get_user_date_format(), strtotime($date_end));
        $seps = array("-", "/");
        $dates = array($date_start, $date_end);
        $dateFileNameSafe = str_replace($seps, "_", $dates);
        $cache_file_name = sugar_cached("xml/") . $current_user->getUserPrivGuid() . "_outcome_by_month_" . $dateFileNameSafe[0] . "_" . $dateFileNameSafe[1] . ".xml";
        Log::debug("cache file name is: {$cache_file_name}");
        global $app_strings;
        $tools = '<div align="right"><a href="index.php?module=' . $currentModule . '&action=' . $action . '&obm_refresh=true" class="tabFormAdvLink">' . SugarThemeRegistry::current()->getImage('refresh', 'border="0" align="absmiddle"', null, null, '.gif', $mod_strings['LBL_REFRESH']) . '&nbsp;' . $current_module_strings['LBL_REFRESH'] . '</a>&nbsp;&nbsp;<a href="javascript: toggleDisplay(\'outcome_by_month_edit\');" class="tabFormAdvLink">' . SugarThemeRegistry::current()->getImage('edit', 'border="0" align="absmiddle"', null, null, '.gif', $mod_strings['LBL_EDIT']) . '&nbsp;' . $current_module_strings['LBL_EDIT'] . '</a>&nbsp;&nbsp;' . $extra_tools . '</div>';
        ?>
	<?php 
        echo '<span onmouseover="this.style.cursor=\'move\'" id="chart_handle_' . $this->order . '">' . get_form_header($current_module_strings['LBL_YEAR_BY_OUTCOME'], $tools, false) . '</span>';
        ?>

<?php 
        $cal_lang = "en";
        $cal_dateformat = parse_calendardate($app_strings['NTC_DATE_FORMAT']);
        if (empty($_SESSION['obm_ids'])) {
            $_SESSION['obm_ids'] = "";
        }
        ?>
<p>
<div id='outcome_by_month_edit' style='display: none;'>
<form name="outcome_by_month" action="index.php" method="post" >
<input type="hidden" name="module" value="<?php 
        echo $currentModule;
        ?>
">
<input type="hidden" name="action" value="<?php 
        echo $action;
        ?>
">
<input type="hidden" name="obm_refresh" value="true">
<input type="hidden" name="obm_date_start" value="<?php 
        if (isset($_SESSION['obm_date_start'])) {
            echo $_SESSION['obm_date_start'];
        }
        ?>
">
<input type="hidden" name="obm_date_end" value="<?php 
        if (isset($_SESSION['obm_date_end'])) {
            echo $_SESSION['obm_date_end'];
        }
        ?>
">
<table cellpadding="0" cellspacing="0" border="0" class="edit view" align="center">
<tr>
	<td valign='top' nowrap ><b><?php 
        echo $current_module_strings['LBL_YEAR'];
        ?>
</b><br><span class="dateFormat"><?php 
        echo $app_strings['NTC_YEAR_FORMAT'];
        ?>
</span></td>
	<td valign='top' ><input class="text" name="obm_year" size='12' maxlength='10' id='obm_year'  value='<?php 
        if (isset($date_start)) {
            echo substr($date_start, 0, 4);
        }
        ?>
'>&nbsp;&nbsp;</td>
	<td valign='top'><b><?php 
        echo $current_module_strings['LBL_USERS'];
        ?>
</b></td>
	<td valign='top'><select name="obm_ids[]" multiple size='3'><?php 
        echo get_select_options_with_id(get_user_array(false), $ids);
        ?>
</select></td>
	<td align="right" valign="top"><input class="button" onclick="return verify_chart_data_outcome_by_month();" type="submit" title="<?php 
        echo $app_strings['LBL_SELECT_BUTTON_TITLE'];
        ?>
" value="<?php 
        echo $app_strings['LBL_SELECT_BUTTON_LABEL'];
        ?>
" /><input class="button" onClick="javascript: toggleDisplay('outcome_by_month_edit');" type="button" title="<?php 
        echo $app_strings['LBL_CANCEL_BUTTON_TITLE'];
        ?>
" accessKey="<?php 
        echo $app_strings['LBL_CANCEL_BUTTON_KEY'];
        ?>
" value="<?php 
        echo $app_strings['LBL_CANCEL_BUTTON_LABEL'];
        ?>
"/></td>
</tr>
</table>
</form>

</div>
</p>
<?php 
        // draw chart
        echo "<p align='center'>" . $this->gen_xml($date_start, $date_end, $ids, $cache_file_name, $refresh, $current_module_strings) . "</p>";
        echo "<P align='center'><span class='chartFootnote'>" . $current_module_strings['LBL_MONTH_BY_OUTCOME_DESC'] . "</span></P>";
        ?>


<?php 
        if (file_exists($cache_file_name)) {
            $file_date = $timedate->asUser($timedate->fromTimestamp(filemtime($cache_file_name)));
        } else {
            $file_date = '';
        }
        ?>

<span class='chartFootnote'>
<p align="right"><i><?php 
        echo $current_module_strings['LBL_CREATED_ON'] . ' ' . $file_date;
        ?>
</i></p>
</span>
<?php 
        echo get_validate_chart_js();
    }
示例#12
0
 /**
  *
  */
 function process_page()
 {
     global $theme;
     global $mod_strings;
     global $app_strings;
     global $app_list_strings;
     global $currentModule;
     global $sugar_version, $sugar_config;
     $output_html = '';
     $where = '';
     $where = $this->_get_where_clause();
     $name = empty($_REQUEST['name']) ? '' : $_REQUEST['name'];
     $status = empty($_REQUEST['status']) ? '' : $_REQUEST['status'];
     $campaign_type = empty($_REQUEST['campaign_type']) ? '' : $_REQUEST['campaign_type'];
     $request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data'];
     $hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true;
     $button = "<form action='index.php' method='post' name='form' id='form'>\n";
     //START:FOR MULTI-SELECT
     $multi_select = false;
     if (!empty($_REQUEST['mode']) && strtoupper($_REQUEST['mode']) == 'MULTISELECT') {
         $multi_select = true;
         $button .= "<input type='button' name='button' class='button' onclick=\"send_back_selected('Prospects',document.MassUpdate,'mass[]','" . $app_strings['ERR_NOTHING_SELECTED'] . "');\" title='" . $app_strings['LBL_SELECT_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_SELECT_BUTTON_KEY'] . "' value='  " . $app_strings['LBL_SELECT_BUTTON_LABEL'] . "  ' />\n";
     }
     //END:FOR MULTI-SELECT
     if (!$hide_clear_button) {
         $button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='" . $app_strings['LBL_CLEAR_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_CLEAR_BUTTON_KEY'] . "' value='  " . $app_strings['LBL_CLEAR_BUTTON_LABEL'] . "  ' />\n";
     }
     $button .= "<input type='submit' name='button' class='button' onclick=\"window.close();\" title='" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_CANCEL_BUTTON_KEY'] . "' value='  " . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . "  ' />\n";
     $button .= "</form>\n";
     $form = new XTemplate('modules/Campaigns/Popup_picker.html');
     $form->assign('MOD', $mod_strings);
     $form->assign('APP', $app_strings);
     $form->assign('THEME', $theme);
     $form->assign('MODULE_NAME', $currentModule);
     $form->assign('request_data', $request_data);
     $form->assign("TYPE_OPTIONS", get_select_options_with_id($app_list_strings['campaign_type_dom'], ""));
     ob_start();
     insert_popup_header($theme);
     $output_html .= ob_get_contents();
     ob_end_clean();
     $output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false);
     $form->parse('main.SearchHeader');
     $output_html .= $form->text('main.SearchHeader');
     // Reset the sections that are already in the page so that they do not print again later.
     $form->reset('main.SearchHeader');
     // create the listview
     $seed_bean = new Campaign();
     $ListView = new ListView();
     $ListView->show_export_button = false;
     $ListView->process_for_popups = true;
     $ListView->setXTemplate($form);
     $ListView->multi_select_popup = $multi_select;
     //FOR MULTI-SELECT
     $ListView->xTemplate->assign("TAG_TYPE", "A");
     //FOR MULTI-SELECT
     $ListView->setHeaderTitle($mod_strings['LBL_LIST_FORM_TITLE']);
     //FOR MULTI-SELECT
     $ListView->setHeaderText($button);
     //FOR MULTI-SELECT
     $ListView->setQuery($where, '', 'name', 'CAMPAIGN');
     $ListView->setModStrings($mod_strings);
     ob_start();
     //$output_html .= get_form_header($mod_strings['LBL_LIST_FORM_TITLE'], $button, false); //FOR MULTI-SELECT
     $ListView->processListView($seed_bean, 'main', 'CAMPAIGN');
     $output_html .= ob_get_contents();
     ob_end_clean();
     $output_html .= insert_popup_footer();
     return $output_html;
 }
示例#13
0
 function display($title = '', $section = 'main', $return = FALSE)
 {
     if ($this->type == 1) {
         ob_start();
         $this->lv->setHeaderTitle($title);
         $this->lv->processListView($this->focus, $section, $this->prefix);
         $output = ob_get_contents();
         ob_end_clean();
     } else {
         $output = get_form_header($title, '', false) . $this->lv->display();
     }
     if ($return) {
         return $output;
     } else {
         echo $output;
     }
 }
    function draw($extra_tools)
    {
        require_once 'include/utils.php';
        global $app_list_strings, $current_language, $ids, $sugar_config, $theme;
        $current_module_strings = return_module_language($current_language, 'Charts');
        if (isset($_REQUEST['pbls_refresh'])) {
            $refresh = $_REQUEST['pbls_refresh'];
        } else {
            $refresh = false;
        }
        $tempx = array();
        $datax = array();
        $selected_datax = array();
        //get list of sales stage keys to display
        global $current_user;
        $user_tempx = $current_user->getPreference('pbls_lead_sources');
        if (!empty($user_tempx) && count($user_tempx) > 0 && !isset($_REQUEST['pbls_lead_sources'])) {
            $tempx = $user_tempx;
            $GLOBALS['log']->debug("USER PREFERENCES['pbls_lead_sources'] is:");
            $GLOBALS['log']->debug($user_tempx);
        } elseif (isset($_REQUEST['pbls_lead_sources']) && count($_REQUEST['pbls_lead_sources']) > 0) {
            $tempx = $_REQUEST['pbls_lead_sources'];
            $current_user->setPreference('pbls_lead_sources', $_REQUEST['pbls_lead_sources']);
            $GLOBALS['log']->debug("_REQUEST['pbls_lead_sources'] is:");
            $GLOBALS['log']->debug($_REQUEST['pbls_lead_sources']);
            $GLOBALS['log']->debug("USER PREFERENCES['pbls_lead_sources'] is:");
            $GLOBALS['log']->debug($current_user->getPreference('pbls_lead_sources'));
        }
        //set $datax using selected sales stage keys
        if (count($tempx) > 0) {
            foreach ($tempx as $key) {
                $datax[$key] = $app_list_strings['lead_source_dom'][$key];
                array_push($selected_datax, $key);
            }
        } else {
            $datax = $app_list_strings['lead_source_dom'];
            $selected_datax = array_keys($app_list_strings['lead_source_dom']);
        }
        $GLOBALS['log']->debug("datax is:");
        $GLOBALS['log']->debug($datax);
        $ids = array();
        $user_ids = $current_user->getPreference('pbls_ids');
        //get list of user ids for which to display data
        if (!empty($user_ids) && count($user_ids) != 0 && !isset($_REQUEST['pbls_ids'])) {
            if (isset($_SESSION['pbls_ids'])) {
                $ids = $_SESSION['pbls_ids'];
            }
            $GLOBALS['log']->debug("USER PREFERENCES['pbls_ids'] is:");
            $GLOBALS['log']->debug($user_ids);
        } elseif (isset($_REQUEST['pbls_ids']) && count($_REQUEST['pbls_ids']) > 0) {
            $ids = $_REQUEST['pbls_ids'];
            $current_user->setPreference('pbls_ids', $ids);
            $GLOBALS['log']->debug("_REQUEST['pbls_ids'] is:");
            $GLOBALS['log']->debug($_REQUEST['pbls_ids']);
            $GLOBALS['log']->debug("USER PREFERENCES['pbls_ids'] is:");
            $GLOBALS['log']->debug($current_user->getPreference('pbls_ids'));
        } else {
            $ids = get_user_array(false);
            $ids = array_keys($ids);
        }
        //create unique prefix based on selected users for image files
        $id_hash = '1';
        if (isset($ids) && is_array($ids)) {
            sort($ids);
            $id_hash = crc32(implode('', $ids));
            if ($id_hash < 0) {
                $id_hash = $id_hash * -1;
            }
        }
        $GLOBALS['log']->debug("ids is:");
        $GLOBALS['log']->debug($ids);
        $id_md5 = substr(md5($current_user->id), 0, 9);
        $seps = array("-", "/");
        $dates = array(date('Y-m-d'), date('Y-m-d'));
        $dateFileNameSafe = str_replace($seps, "_", $dates);
        $cache_file_name = $current_user->getUserPrivGuid() . "_pipeline_by_lead_source_" . $dateFileNameSafe[0] . "_" . $dateFileNameSafe[1] . ".xml";
        $GLOBALS['log']->debug("cache file name is: {$cache_file_name}");
        global $currentModule, $action, $image_path;
        $tools = '<div align="right"><a href="index.php?module=' . $currentModule . '&action=' . $action . '&pbls_refresh=true" class="chartToolsLink">' . get_image($image_path . 'refresh', 'alt="Refresh"  border="0" align="absmiddle"') . '&nbsp;' . $current_module_strings['LBL_REFRESH'] . '</a>&nbsp;&nbsp;<a href="javascript: toggleDisplay(\'pbls_edit\');" class="chartToolsLink">' . get_image($image_path . 'edit', 'alt="Edit"  border="0"  align="absmiddle"') . '&nbsp;' . $current_module_strings['LBL_EDIT'] . '</a>&nbsp;&nbsp;' . $extra_tools . '</div>';
        ?>

<?php 
        echo '<span onmouseover="this.style.cursor=\'move\'" id="chart_handle_' . $this->order . '">' . get_form_header($current_module_strings['LBL_LEAD_SOURCE_FORM_TITLE'], $tools, false) . '</span>';
        if (empty($_SESSION['pbls_lead_sources'])) {
            $_SESSION['pbls_lead_sources'] = "";
        }
        if (empty($_SESSION['pbls_ids'])) {
            $_SESSION['pbls_ids'] = "";
        }
        ?>

<p>
<div id='pbls_edit' style='display: none;'>
<form action="index.php" method="post" >
<input type="hidden" name="module" value="<?php 
        echo $currentModule;
        ?>
">
<input type="hidden" name="action" value="<?php 
        echo $action;
        ?>
">
<input type="hidden" name="pbls_refresh" value="true">
<table cellpadding="0" cellspacing="0" border="0" class="chartForm" align="center">
<tr>
	<td valign='top' nowrap><b><?php 
        echo $current_module_strings['LBL_LEAD_SOURCES'];
        ?>
</b></td>
	<td valign='top'><select name="pbls_lead_sources[]" multiple size='3'><?php 
        echo get_select_options_with_id($app_list_strings['lead_source_dom'], $selected_datax);
        ?>
</select></td>
	<td valign='top' nowrap><b><?php 
        echo $current_module_strings['LBL_USERS'];
        ?>
</b></td>
	<td valign='top'><select name="pbls_ids[]" multiple size='3'><?php 
        $allUsers = get_user_array(false);
        echo get_select_options_with_id($allUsers, $ids);
        ?>
</select></td>
<?php 
        global $app_strings;
        ?>
	<td align="right" valign="top"><input class="button" type="submit" title="<?php 
        echo $app_strings['LBL_SELECT_BUTTON_TITLE'];
        ?>
" accessKey="<?php 
        echo $app_strings['LBL_SELECT_BUTTON_KEY'];
        ?>
" value="<?php 
        echo $app_strings['LBL_SELECT_BUTTON_LABEL'];
        ?>
" /><input class="button" onClick="javascript: toggleDisplay('pbls_edit');" type="button" title="<?php 
        echo $app_strings['LBL_CANCEL_BUTTON_TITLE'];
        ?>
" accessKey="<?php 
        echo $app_strings['LBL_CANCEL_BUTTON_KEY'];
        ?>
" value="<?php 
        echo $app_strings['LBL_CANCEL_BUTTON_LABEL'];
        ?>
"/></td>
</tr>
</table>
</form>
</div>
</p>
<?php 
        // draw table
        echo "<p align='center'>" . $this->gen_xml($datax, $ids, $sugar_config['tmp_dir'] . $cache_file_name, $refresh, $current_module_strings) . "</p>";
        echo "<P align='center'><span class='chartFootnote'>" . $current_module_strings['LBL_LEAD_SOURCE_FORM_DESC'] . "</span></P>";
        if (file_exists($sugar_config['tmp_dir'] . $cache_file_name)) {
            global $timedate;
            $file_date = date($timedate->get_date_format() . " " . $timedate->get_time_format(), filemtime($sugar_config['tmp_dir'] . $cache_file_name));
        } else {
            $file_date = '';
        }
        ?>
<span class='chartFootnote'>
<p align="right"><i><?php 
        echo $current_module_strings['LBL_CREATED_ON'] . ' ' . $file_date;
        ?>
</i></p>
</span>
<?php 
    }
示例#15
0
    function display($showContainer = true, $forceTabless = false)
    {
        global $layout_edit_mode, $sugar_version, $sugar_config, $current_user, $app_strings;
        if (isset($layout_edit_mode) && $layout_edit_mode) {
            return;
        }
        global $modListHeader;
        ob_start();
        echo '<script type="text/javascript" src="' . getJSPath('include/SubPanel/SubPanelTiles.js') . '"></script>';
        ?>
<script>
if(document.DetailView != null &&
   document.DetailView.elements != null &&
   document.DetailView.elements.layout_def_key != null &&
   typeof document.DetailView.elements['layout_def_key'] != 'undefined'){
    document.DetailView.elements['layout_def_key'].value = '<?php 
        echo $this->layout_def_key;
        ?>
';
}
</script>
<?php 
        $tabs = array();
        $default_div_display = 'inline';
        if (!empty($sugar_config['hide_subpanels_on_login'])) {
            if (!isset($_SESSION['visited_details'][$this->focus->module_dir])) {
                setcookie($this->focus->module_dir . '_divs', '');
                unset($_COOKIE[$this->focus->module_dir . '_divs']);
                $_SESSION['visited_details'][$this->focus->module_dir] = true;
            }
            $default_div_display = 'none';
        }
        $div_cookies = get_sub_cookies($this->focus->module_dir . '_divs');
        //Display the group header. this section is executed only if the tabbed interface is being used.
        $current_key = '';
        if (!empty($this->show_tabs)) {
            require_once 'include/tabs.php';
            $tab_panel = new SugarWidgetTabs($tabs, $current_key, 'showSubPanel');
            echo get_form_header('Related', '', false);
            echo "<br />" . $tab_panel->display();
        }
        if (empty($_REQUEST['subpanels'])) {
            $selected_group = $forceTabless ? '' : $this->getSelectedGroup();
            $usersLayout = $current_user->getPreference('subpanelLayout', $this->focus->module_dir);
            // we need to use some intelligence here when restoring the user's layout, as new modules with new subpanels might have been installed since the user's layout was recorded
            // this means that we can't just restore the old layout verbatim as the new subpanels would then go walkabout
            // so we need to do a merge while attempting as best we can to preserve the sense of the specified order
            // this is complicated by the different ordering schemes used in the two sources for the panels: the user's layout uses an ordinal layout, the panels from getTabs have an explicit ordering driven by the 'order' parameter
            // it's not clear how to best reconcile these two schemes; so we punt on it, and add all new panels to the end of the user's layout. At least this will give them a clue that something has changed...
            // we also now check for tabs that have been removed since the user saved his or her preferences.
            $tabs = $this->getTabs($showContainer, $selected_group);
            if (!empty($usersLayout)) {
                $availableTabs = $tabs;
                $tabs = array_intersect($usersLayout, $availableTabs);
                // remove any tabs that have been removed since the user's layout was saved
                foreach (array_diff($availableTabs, $usersLayout) as $tab) {
                    $tabs[] = $tab;
                }
            }
        } else {
            $tabs = explode(',', $_REQUEST['subpanels']);
        }
        $tab_names = array();
        if ($showContainer) {
            echo '<ul class="noBullet" id="subpanel_list">';
        }
        //echo "<li id='hidden_0' style='height: 5px' class='noBullet'>&nbsp;&nbsp;&nbsp;</li>";
        if (empty($GLOBALS['relationships'])) {
            if (!class_exists('Relationship')) {
                require 'modules/Relationships/Relationship.php';
            }
            $rel = new Relationship();
            $rel->load_relationship_meta();
        }
        // this array will store names of sub-panels that can contain items
        // of each module
        $module_sub_panels = array();
        foreach ($tabs as $tab) {
            //load meta definition of the sub-panel.
            $thisPanel = $this->subpanel_definitions->load_subpanel($tab);
            if ($thisPanel === false) {
                continue;
            }
            //this if-block will try to skip over ophaned subpanels. Studio/MB are being delete unloaded modules completely.
            //this check will ignore subpanels that are collections (activities, history, etc)
            if (!isset($thisPanel->_instance_properties['collection_list']) and isset($thisPanel->_instance_properties['get_subpanel_data'])) {
                //ignore when data source is a function
                if (!isset($this->focus->field_defs[$thisPanel->_instance_properties['get_subpanel_data']])) {
                    if (stripos($thisPanel->_instance_properties['get_subpanel_data'], 'function:') === false) {
                        Log::fatal("Bad subpanel definition, it has incorrect value for get_subpanel_data property " . $tab);
                        continue;
                    }
                } else {
                    $rel_name = '';
                    if (isset($this->focus->field_defs[$thisPanel->_instance_properties['get_subpanel_data']]['relationship'])) {
                        $rel_name = $this->focus->field_defs[$thisPanel->_instance_properties['get_subpanel_data']]['relationship'];
                    }
                    if (empty($rel_name) or !isset($GLOBALS['relationships'][$rel_name])) {
                        Log::fatal("Missing relationship definition " . $rel_name . ". skipping " . $tab . " subpanel");
                        continue;
                    }
                }
            }
            if ($thisPanel->isCollection()) {
                // collect names of sub-panels that may contain items of each module
                $collection_list = $thisPanel->get_inst_prop_value('collection_list');
                if (is_array($collection_list)) {
                    foreach ($collection_list as $data) {
                        if (!empty($data['module'])) {
                            $module_sub_panels[$data['module']][$tab] = true;
                        }
                    }
                }
            } else {
                $module = $thisPanel->get_module_name();
                if (!empty($module)) {
                    $module_sub_panels[$module][$tab] = true;
                }
            }
            echo '<li class="noBullet" id="whole_subpanel_' . $tab . '">';
            $display = 'none';
            $div_display = $default_div_display;
            $cookie_name = $tab . '_v';
            if (isset($thisPanel->_instance_properties['collapsed']) && $thisPanel->_instance_properties['collapsed']) {
                $div_display = 'none';
            }
            if (isset($div_cookies[$cookie_name])) {
                //If defaultSubPanelExpandCollapse is set, ignore the cookie that remembers whether the panel is expanded or collapsed.
                //To be used with the above 'collapsed' metadata setting so they will always be set the same when the page is loaded.
                if (!isset($sugar_config['defaultSubPanelExpandCollapse']) || $sugar_config['defaultSubPanelExpandCollapse'] == false) {
                    $div_display = $div_cookies[$cookie_name];
                }
            }
            if (!empty($sugar_config['hide_subpanels'])) {
                $div_display = 'none';
            }
            if ($thisPanel->isDefaultHidden()) {
                $div_display = 'none';
            }
            if ($div_display == 'none') {
                $opp_display = 'inline';
            } else {
                $opp_display = 'none';
            }
            if (!empty($this->layout_def_key)) {
                $layout_def_key = $this->layout_def_key;
            } else {
                $layout_def_key = '';
            }
            if (empty($this->show_tabs)) {
                $show_icon_html = SugarThemeRegistry::current()->getImage('advanced_search', 'border="0" align="absmiddle"', null, null, '.gif', translate('LBL_SHOW'));
                $hide_icon_html = SugarThemeRegistry::current()->getImage('basic_search', 'border="0" align="absmiddle"', null, null, '.gif', translate('LBL_HIDE'));
                $max_min = "<a name=\"{$tab}\"> </a><span id=\"show_link_" . $tab . "\" style=\"display: {$opp_display}\"><a href='#' class='utilsLink' onclick=\"current_child_field = '" . $tab . "';showSubPanel('" . $tab . "',null,null,'" . $layout_def_key . "');document.getElementById('show_link_" . $tab . "').style.display='none';document.getElementById('hide_link_" . $tab . "').style.display='';return false;\">" . "" . $show_icon_html . "</a></span>";
                $max_min .= "<span id=\"hide_link_" . $tab . "\" style=\"display: {$div_display}\"><a href='#' class='utilsLink' onclick=\"hideSubPanel('" . $tab . "');document.getElementById('hide_link_" . $tab . "').style.display='none';document.getElementById('show_link_" . $tab . "').style.display='';return false;\">" . "" . $hide_icon_html . "</a></span>";
                echo '<div id="subpanel_title_' . $tab . '"';
                if (empty($sugar_config['lock_subpanels']) || $sugar_config['lock_subpanels'] == false) {
                    echo ' onmouseover="this.style.cursor = \'move\';"';
                }
                echo '>' . get_form_header($thisPanel->get_title(), $max_min, false) . '</div>';
            }
            echo <<<EOQ
<div cookie_name="{$cookie_name}" id="subpanel_{$tab}" style="display:{$div_display}">
    <script>document.getElementById("subpanel_{$tab}" ).cookie_name="{$cookie_name}";</script>
EOQ;
            $display_spd = '';
            if ($div_display != 'none') {
                echo "<script>SUGAR.util.doWhen(\"typeof(markSubPanelLoaded) != 'undefined'\", function() {markSubPanelLoaded('{$tab}');});</script>";
                $old_contents = ob_get_contents();
                @ob_end_clean();
                ob_start();
                include_once 'include/SubPanel/SubPanel.php';
                $subpanel_object = new SubPanel($this->module, $_REQUEST['record'], $tab, $thisPanel, $layout_def_key);
                $subpanel_object->setTemplateFile('include/SubPanel/SubPanelDynamic.html');
                $subpanel_object->display();
                $subpanel_data = ob_get_contents();
                @ob_end_clean();
                ob_start();
                echo $this->get_buttons($thisPanel, $subpanel_object->subpanel_query);
                $buttons = ob_get_contents();
                @ob_end_clean();
                ob_start();
                echo $old_contents;
                //echo $buttons;
                $display_spd = $subpanel_data;
            }
            echo <<<EOQ
    <div id="list_subpanel_{$tab}">{$display_spd}</div>
</div>
EOQ;
            array_push($tab_names, $tab);
            echo '</li>';
        }
        // end $tabs foreach
        if ($showContainer) {
            echo '</ul>';
            if (!empty($selected_group)) {
                // closing table from tpls/singletabmenu.tpl
                echo '</td></tr></table>';
            }
        }
        // drag/drop code
        $tab_names = '["' . join($tab_names, '","') . '"]';
        global $sugar_config;
        if (empty($sugar_config['lock_subpanels']) || $sugar_config['lock_subpanels'] == false) {
            echo <<<EOQ
    <script>
    \tvar SubpanelInit = function() {
    \t\tSubpanelInitTabNames({$tab_names});
    \t}
        var SubpanelInitTabNames = function(tabNames) {
    \t\tsubpanel_dd = new Array();
    \t\tj = 0;
    \t\tfor(i in tabNames) {
    \t\t\tsubpanel_dd[j] = new ygDDList('whole_subpanel_' + tabNames[i]);
    \t\t\tsubpanel_dd[j].setHandleElId('subpanel_title_' + tabNames[i]);
    \t\t\tsubpanel_dd[j].onMouseDown = SUGAR.subpanelUtils.onDrag;
    \t\t\tsubpanel_dd[j].afterEndDrag = SUGAR.subpanelUtils.onDrop;
    \t\t\tj++;
    \t\t}

    \t\tYAHOO.util.DDM.mode = 1;
    \t}
    \tcurrentModule = '{$this->module}';
    \tSUGAR.util.doWhen(
    \t    "typeof(SUGAR.subpanelUtils) == 'object' && typeof(SUGAR.subpanelUtils.onDrag) == 'function'" +
    \t        " && document.getElementById('subpanel_list')",
    \t    SubpanelInit
    \t);
    </script>
EOQ;
        }
        $module_sub_panels = array_map('array_keys', $module_sub_panels);
        $module_sub_panels = json_encode($module_sub_panels);
        echo <<<EOQ
<script>
var ModuleSubPanels = {$module_sub_panels};
</script>
EOQ;
        $ob_contents = ob_get_contents();
        ob_end_clean();
        return $ob_contents;
    }
 function search()
 {
     if (!file_exists('cache/modules/unified_search_modules.php')) {
         $this->buildCache();
     }
     include 'cache/modules/unified_search_modules.php';
     require_once 'include/ListView/ListViewSmarty.php';
     require_once 'include/utils.php';
     global $modListHeader, $beanList, $beanFiles, $current_language, $app_strings, $current_user, $mod_strings;
     $home_mod_strings = return_module_language($current_language, 'Home');
     $overlib = true;
     $_REQUEST['query_string'] = PearDatabase::quote(from_html(clean_string($_REQUEST['query_string'], 'UNIFIED_SEARCH')));
     if (!empty($_REQUEST['advanced']) && $_REQUEST['advanced'] != 'false') {
         $modules_to_search = array();
         foreach ($_REQUEST as $param => $value) {
             if (preg_match('/^search_mod_(.*)$/', $param, $match)) {
                 $modules_to_search[$match[1]] = $beanList[$match[1]];
             }
         }
         $current_user->setPreference('globalSearch', $modules_to_search, 0, 'search');
         // save selections to user preference
     } else {
         $users_modules = $current_user->getPreference('globalSearch', 'search');
         if (isset($users_modules)) {
             // use user's previous selections
             $modules_to_search = $users_modules;
         } else {
             // select all the modules (ie first time user has used global search)
             foreach ($unified_search_modules as $module => $data) {
                 $modules_to_search[$module] = $beanList[$module];
             }
             $current_user->setPreference('globalSearch', $modules_to_search, 'search');
         }
     }
     echo $this->getDropDownDiv('modules/Home/UnifiedSearchAdvancedForm.tpl');
     $module_results = array();
     $module_counts = array();
     $has_results = false;
     if (!empty($_REQUEST['query_string'])) {
         foreach ($modules_to_search as $name => $beanName) {
             if (array_key_exists($name, $modListHeader)) {
                 $where_clauses_array = array();
                 foreach ($unified_search_modules[$name]['fields'] as $field => $def) {
                     $clause = '';
                     if (isset($def['table'])) {
                         // if field is from joining table
                         $clause = "{$def['table']}.{$def['rname']} ";
                     } else {
                         $clause = "{$unified_search_modules[$name]['table']}.{$field} ";
                     }
                     switch ($def['type']) {
                         case 'int':
                             if (is_numeric($_REQUEST['query_string'])) {
                                 $clause .= "in ('{$_REQUEST['query_string']}')";
                             } else {
                                 $clause .= "in ('-1')";
                             }
                             break;
                         default:
                             $clause .= "LIKE '{$_REQUEST['query_string']}%'";
                             break;
                     }
                     array_push($where_clauses_array, $clause);
                 }
                 $where = implode(' or ', $where_clauses_array);
                 require_once $beanFiles[$beanName];
                 $seed = new $beanName();
                 $lv = new ListViewSmarty();
                 $lv->lvd->additionalDetails = false;
                 $mod_strings = return_module_language($current_language, $seed->module_dir);
                 if (file_exists('custom/modules/' . $seed->module_dir . '/metadata/listviewdefs.php')) {
                     require_once 'custom/modules/' . $seed->module_dir . '/metadata/listviewdefs.php';
                 } else {
                     require_once 'modules/' . $seed->module_dir . '/metadata/listviewdefs.php';
                 }
                 $displayColumns = array();
                 foreach ($listViewDefs[$seed->module_dir] as $colName => $param) {
                     if (!empty($param['default']) && $param['default'] == true) {
                         $displayColumns[$colName] = $param;
                     }
                 }
                 if (count($displayColumns) > 0) {
                     $lv->displayColumns = $displayColumns;
                 } else {
                     $lv->displayColumns = $listViewDefs[$seed->module_dir];
                 }
                 $lv->export = false;
                 $lv->mergeduplicates = false;
                 $lv->multiSelect = false;
                 if ($overlib) {
                     $lv->overlib = true;
                     $overlib = false;
                 } else {
                     $lv->overlib = false;
                 }
                 $lv->setup($seed, 'include/ListView/ListViewGeneric.tpl', $where, 0, 10);
                 $module_results[$name] = '<br /><br />' . get_form_header($GLOBALS['app_list_strings']['moduleList'][$seed->module_dir] . ' (' . $lv->data['pageData']['offsets']['total'] . ')', '', false);
                 $module_counts[$name] = $lv->data['pageData']['offsets']['total'];
                 if ($lv->data['pageData']['offsets']['total'] == 0) {
                     $module_results[$name] .= '<h2>' . $home_mod_strings['LBL_NO_RESULTS_IN_MODULE'] . '</h2>';
                 } else {
                     $has_results = true;
                     $module_results[$name] .= $lv->display(false, false);
                 }
             }
         }
     }
     if ($has_results) {
         arsort($module_counts);
         foreach ($module_counts as $name => $value) {
             echo $module_results[$name];
         }
     } else {
         echo '<br>';
         echo $home_mod_strings['LBL_NO_RESULTS'];
         echo $home_mod_strings['LBL_NO_RESULTS_TIPS'];
     }
 }
示例#17
0
 function display($title = '', $section = 'main')
 {
     if ($this->type == 1) {
         $this->lv->setHeaderTitle($title);
         $this->lv->processListView($this->focus, $section, $this->prefix);
     } else {
         echo get_form_header($title, '', false);
         echo $this->lv->display();
     }
 }
 function buildTableForm($rows, $mod = '')
 {
     global $action;
     if (!empty($mod)) {
         global $current_language;
         $mod_strings = return_module_language($current_language, $mod);
     } else {
         global $mod_strings;
     }
     global $app_strings;
     $cols = sizeof($rows[0]) * 2 + 1;
     if ($action != 'ShowDuplicates') {
         $form = '<table width="100%"><tr><td>' . $mod_strings['MSG_DUPLICATE'] . '</td></tr><tr><td height="20"></td></tr></table>';
         $form .= "<form action='index.php' method='post' name='dupProspects'><input type='hidden' name='selectedProspect' value=''>";
     } else {
         $form = '<table width="100%"><tr><td>' . $mod_strings['MSG_SHOW_DUPLICATES'] . '</td></tr><tr><td height="20"></td></tr></table>';
     }
     $form .= get_form_header($mod_strings['LBL_DUPLICATE'], "", '');
     $form .= "<table width='100%' cellpadding='0' cellspacing='0'>\t<tr >\t";
     if ($action != 'ShowDuplicates') {
         $form .= "<td > &nbsp;</td>";
     }
     require_once 'include/formbase.php';
     $form .= getPostToForm();
     if (isset($rows[0])) {
         foreach ($rows[0] as $key => $value) {
             if ($key != 'id') {
                 $form .= "<td scope='col' >" . $mod_strings[$mod_strings['db_' . $key]] . "</td>";
             }
         }
         $form .= "</tr>";
     }
     $rowColor = 'oddListRowS1';
     foreach ($rows as $row) {
         $form .= "<tr class='{$rowColor}'>";
         if ($action != 'ShowDuplicates') {
             $form .= "<td width='1%' nowrap='nowrap' ><a href='#' onClick=\"document.dupProspects.selectedProspect.value='{$row['id']}';document.dupProspects.submit() \">[{$app_strings['LBL_SELECT_BUTTON_LABEL']}]</a>&nbsp;&nbsp;</td>\n";
         }
         $wasSet = false;
         foreach ($row as $key => $value) {
             if ($key != 'id') {
                 if (!$wasSet) {
                     $form .= "<td scope='row' ><a target='_blank' href='index.php?module=Prospects&action=DetailView&record={$row['id']}'>{$value}</a></td>\n";
                     $wasSet = true;
                 } else {
                     $form .= "<td><a target='_blank' href='index.php?module=Prospects&action=DetailView&record={$row['id']}'>{$value}</a></td>\n";
                 }
             }
         }
         if ($rowColor == 'evenListRowS1') {
             $rowColor = 'oddListRowS1';
         } else {
             $rowColor = 'evenListRowS1';
         }
         $form .= "</tr>";
     }
     $form .= "<tr ><td colspan='{$cols}' class='blackline'></td></tr>";
     if ($action == 'ShowDuplicates') {
         $form .= "</table><br><input title='{$app_strings['LBL_SAVE_BUTTON_TITLE']}' accessKey='{$app_strings['LBL_SAVE_BUTTON_KEY']}' class='button' onclick=\"this.form.action.value='Save';\" type='submit' name='button' value='  {$app_strings['LBL_SAVE_BUTTON_LABEL']}  '> <input title='{$app_strings['LBL_CANCEL_BUTTON_TITLE']}' accessKey='{$app_strings['LBL_CANCEL_BUTTON_KEY']}' class='button' onclick=\"this.form.action.value='ListView'; this.form.module.value='Prospects';\" type='submit' name='button' value='  {$app_strings['LBL_CANCEL_BUTTON_LABEL']}  '></form>";
     } else {
         $form .= "</table><br><input type='submit' class='button' name='ContinueProspect' value='{$mod_strings['LNK_NEW_PROSPECT']}'></form>";
     }
     return $form;
 }
示例#19
0
    function _getAddFormHeader()
    {
        $lbl_save_button_title = $GLOBALS['app_strings']['LBL_SAVE_BUTTON_TITLE'];
        $lbl_save_button_key = $GLOBALS['app_strings']['LBL_SAVE_BUTTON_KEY'];
        $lbl_save_button_label = $GLOBALS['app_strings']['LBL_SAVE_BUTTON_LABEL'];
        $module_dir = $this->seed->module_dir;
        $formSave = <<<EOQ
\t\t\t<input type="hidden" name="create" value="true">
\t\t\t<input type="hidden" name="popup" value="true">
\t\t\t<input type="hidden" name="to_pdf" value="true">
\t\t\t<input type="hidden" name="return_module" value="{$module_dir}">
\t\t\t<input type="hidden" name="return_action" value="Popup">
EOQ;
        // if metadata contains custom inputs for the quickcreate
        if (!empty($this->_popupMeta['customInput']) && is_array($this->_popupMeta['customInput'])) {
            foreach ($this->_popupMeta['customInput'] as $key => $value) {
                $formSave .= '<input type="hidden" name="' . $key . '" value="' . $value . '">\\n';
            }
        }
        $addformheader = get_form_header(translate($this->_popupMeta['create']['createButton']), $formSave, false);
        return $addformheader;
    }
    function draw($extra_tools)
    {
        global $action;
        global $app_list_strings;
        global $app_strings;
        global $current_language;
        global $current_user;
        global $currentModule;
        global $sugar_config;
        global $theme;
        global $timedate;
        $user_dateFormat = $timedate->get_date_format();
        $current_module_strings = return_module_language($current_language, 'Charts');
        if (isset($_REQUEST['pbss_refresh'])) {
            $refresh = $_REQUEST['pbss_refresh'];
        } else {
            $refresh = false;
        }
        //get the dates to display
        $user_date_start = $current_user->getPreference('pbss_date_start');
        if (!empty($user_date_start) && !isset($_REQUEST['pbss_date_start'])) {
            $date_start = $timedate->to_display_date($user_date_start, false);
            Log::debug("USER PREFERENCES['pbss_date_start'] is:");
            Log::debug($user_date_start);
        } elseif (isset($_REQUEST['pbss_date_start']) && $_REQUEST['pbss_date_start'] != '') {
            $date_start = $_REQUEST['pbss_date_start'];
            $ds = $timedate->to_db_date($date_start, false);
            $current_user->setPreference('pbss_date_start', $ds);
            Log::debug("_REQUEST['pbss_date_start'] is:");
            Log::debug($_REQUEST['pbss_date_start']);
            Log::debug("USER PREFERENCES['pbss_date_start'] is:");
            Log::debug($current_user->getPreference('pbss_date_start'));
        } else {
            $date_start = $timedate->nowDate();
        }
        $user_date_end = $current_user->getPreference('pbss_date_end');
        if (!empty($user_date_end) && !isset($_REQUEST['pbss_date_end'])) {
            $date_end = $timedate->to_display_date($user_date_end, false);
            Log::debug("USER PREFERENCES['pbss_date_end'] is:");
            Log::debug($user_date_end);
        } elseif (isset($_REQUEST['pbss_date_end']) && $_REQUEST['pbss_date_end'] != '') {
            $date_end = $_REQUEST['pbss_date_end'];
            $de = $timedate->to_db_date($date_end, false);
            $current_user->setPreference('pbss_date_end', $de);
            Log::debug("_REQUEST['pbss_date_end'] is:");
            Log::debug($_REQUEST['pbss_date_end']);
            Log::debug("USER PREFERENCES['pbss_date_end'] is:");
            Log::debug($current_user->getPreference('pbss_date_end'));
        } else {
            $date_end = $timedate->asUserDate($timedate->fromString("2010-01-01"));
            Log::debug("USER PREFERENCES['pbss_date_end'] not found. Using: " . $date_end);
        }
        // cn: format date_start|end to user's preferred
        $dateDisplayStart = strftime($timedate->get_user_date_format(), strtotime($date_start));
        $dateDisplayEnd = strftime($timedate->get_user_date_format(), strtotime($date_end));
        $seps = array("-", "/");
        $dates = array($date_start, $date_end);
        $dateFileNameSafe = str_replace($seps, "_", $dates);
        $dateXml[0] = $timedate->swap_formats($date_start, $user_dateFormat, $timedate->dbDayFormat);
        $dateXml[1] = $timedate->swap_formats($date_end, $user_dateFormat, $timedate->dbDayFormat);
        $tempx = array();
        $datax = array();
        $datax_selected = array();
        $user_tempx = $current_user->getPreference('pbss_sales_stages');
        //get list of sales stage keys to display
        if (!empty($user_tempx) && count($user_tempx) > 0 && !isset($_REQUEST['pbss_sales_stages'])) {
            $tempx = $user_tempx;
            Log::debug("USER PREFERENCES['pbss_sales_stages'] is:");
            Log::debug($user_tempx);
        } elseif (isset($_REQUEST['pbss_sales_stages']) && count($_REQUEST['pbss_sales_stages']) > 0) {
            $tempx = $_REQUEST['pbss_sales_stages'];
            $current_user->setPreference('pbss_sales_stages', $_REQUEST['pbss_sales_stages']);
            Log::debug("_REQUEST['pbss_sales_stages'] is:");
            Log::debug($_REQUEST['pbss_sales_stages']);
            Log::debug("USER PREFERENCES['pbss_sales_stages'] is:");
            Log::debug($current_user->getPreference('pbss_sales_stages'));
        }
        //set $datax using selected sales stage keys
        if (count($tempx) > 0) {
            foreach ($tempx as $key) {
                $datax[$key] = $app_list_strings['sales_stage_dom'][$key];
                array_push($datax_selected, $key);
            }
        } else {
            $datax = $app_list_strings['sales_stage_dom'];
            $datax_selected = array_keys($app_list_strings['sales_stage_dom']);
        }
        Log::debug("datax is:");
        Log::debug($datax);
        $ids = array();
        $new_ids = array();
        $user_ids = $current_user->getPreference('pbss_ids');
        //get list of user ids for which to display data
        if (!empty($user_ids) && count($user_ids) != 0 && !isset($_REQUEST['pbss_ids'])) {
            $ids = $user_ids;
            Log::debug("USER PREFERENCES['pbss_ids'] is:");
            Log::debug($user_ids);
        } elseif (isset($_REQUEST['pbss_ids']) && count($_REQUEST['pbss_ids']) > 0) {
            $ids = $_REQUEST['pbss_ids'];
            $current_user->setPreference('pbss_ids', $_REQUEST['pbss_ids']);
            Log::debug("_REQUEST['pbss_ids'] is:");
            Log::debug($_REQUEST['pbss_ids']);
            Log::debug("USER PREFERENCES['pbss_ids'] is:");
            Log::debug($current_user->getPreference('pbss_ids'));
        } else {
            $ids = get_user_array(false);
            $ids = array_keys($ids);
        }
        //create unique prefix based on selected users for image files
        $id_hash = '1';
        if (isset($ids)) {
            sort($ids);
            $id_hash = crc32(implode('', $ids));
            if ($id_hash < 0) {
                $id_hash = $id_hash * -1;
            }
        }
        Log::debug("ids is:");
        Log::debug($ids);
        $cache_file_name = sugar_cached("xml/") . $current_user->getUserPrivGuid() . "_lead_source_by_outcome_" . $dateFileNameSafe[0] . "_" . $dateFileNameSafe[1] . ".xml";
        Log::debug("cache file name is: {$cache_file_name}");
        $tools = '<div align="right"><a href="index.php?module=' . $currentModule . '&action=' . $action . '&pbss_refresh=true" class="tabFormAdvLink">' . SugarThemeRegistry::current()->getImage('refresh', 'border="0" align="absmiddle"', null, null, '.gif', $mod_strings['LBL_REFRESH']) . '&nbsp;' . $current_module_strings['LBL_REFRESH'] . '</a>&nbsp;&nbsp;<a href="javascript: toggleDisplay(\'pipeline_by_sales_stage_edit\');" class="tabFormAdvLink">' . SugarThemeRegistry::current()->getImage('edit', 'border="0" align="absmiddle"', null, null, '.gif', $mod_strings['LBL_EDIT']) . '&nbsp;' . $current_module_strings['LBL_EDIT'] . '</a>&nbsp;&nbsp;' . $extra_tools . '</div>';
        echo '<span onmouseover="this.style.cursor=\'move\'" id="chart_handle_' . $this->order . '">' . get_form_header($current_module_strings['LBL_SALES_STAGE_FORM_TITLE'], $tools, false) . '</span>';
        ?>

<?php 
        $cal_lang = "en";
        $cal_dateformat = $timedate->get_cal_date_format();
        if (empty($_SESSION['pbss_sales_stages'])) {
            $_SESSION['pbss_sales_stages'] = "";
        }
        if (empty($_SESSION['pbss_ids'])) {
            $_SESSION['pbss_ids'] = "";
        }
        // set populate values
        $puser_date_start = $current_user->getPreference('user_date_start');
        ?>
<p>
	<div id='pipeline_by_sales_stage_edit' style='display: none;'>
<form name='pipeline_by_sales_stage' action="index.php" method="post" >
<input type="hidden" name="module" value="<?php 
        echo $currentModule;
        ?>
">
<input type="hidden" name="action" value="<?php 
        echo $action;
        ?>
">
<input type="hidden" name="pbss_refresh" value="true">
<table cellpadding="0" cellspacing="0" border="0" class="edit view" align="center">
<tr>
	<td valign='top' nowrap><b><?php 
        echo $current_module_strings['LBL_DATE_START'];
        ?>
</b> <br><span class="dateFormat"><?php 
        echo "(" . $timedate->get_user_date_format() . ")";
        ?>
</span></td>
	<td valign='top' ><input class="text" name="pbss_date_start" size='12' maxlength='10' id='date_start' value='<?php 
        if (isset($date_start)) {
            echo $date_start;
        }
        ?>
'>  <?php 
        echo SugarThemeRegistry::current()->getImage('jscalendar', 'id="date_start_trigger" align="absmiddle"', null, null, ".gif", $app_strings['LBL_ENTER_DATE']);
        ?>
 </td>
</tr>
<tr>
	<td valign='top' nowrap><b><?php 
        echo $current_module_strings['LBL_DATE_END'];
        ?>
</b><br><span class="dateFormat"><?php 
        echo "(" . $timedate->get_user_date_format() . ")";
        ?>
</span></td>
	<td valign='top' ><input class="text" name="pbss_date_end" size='12' maxlength='10' id='date_end' value='<?php 
        if (isset($date_end)) {
            echo $date_end;
        }
        ?>
'>  <?php 
        echo SugarThemeRegistry::current()->getImage('jscalendar', 'id="date_end_trigger" align="absmiddle"', null, null, ".gif", $app_strings['LBL_ENTER_DATE']);
        ?>
 </td>
</tr>
<tr>
	<td valign='top' nowrap><b><?php 
        echo $current_module_strings['LBL_SALES_STAGES'];
        ?>
</b></td>
	<td valign='top' ><select name="pbss_sales_stages[]" multiple size='3'><?php 
        echo get_select_options_with_id($app_list_strings['sales_stage_dom'], $datax_selected);
        ?>
</select></td>
</tr>
<tr>
	<td valign='top' nowrap><b><?php 
        echo $current_module_strings['LBL_USERS'];
        ?>
</b></td>
	<td valign='top' ><select name="pbss_ids[]" multiple size='3'><?php 
        echo get_select_options_with_id(get_user_array(false), $ids);
        ?>
</select></td>
</tr>
<tr>
<?php 
        global $app_strings;
        ?>
	<td align="right" colspan="2"><input class="button" onclick="return verify_chart_data(pipeline_by_sales_stage);" type="submit" title="<?php 
        echo $app_strings['LBL_SELECT_BUTTON_TITLE'];
        ?>
" value="<?php 
        echo $app_strings['LBL_SELECT_BUTTON_LABEL'];
        ?>
" /><input class="button" onClick="javascript: toggleDisplay('pipeline_by_sales_stage_edit');" type="button" title="<?php 
        echo $app_strings['LBL_CANCEL_BUTTON_TITLE'];
        ?>
" accessKey="<?php 
        echo $app_strings['LBL_CANCEL_BUTTON_KEY'];
        ?>
" value="<?php 
        echo $app_strings['LBL_CANCEL_BUTTON_LABEL'];
        ?>
"/></td>
</tr>
</table>
</form>
<script type="text/javascript">
Calendar.setup ({
	inputField : "date_start", ifFormat : "<?php 
        echo $cal_dateformat;
        ?>
", showsTime : false, button : "date_start_trigger", singleClick : true, step : 1, weekNumbers:false
});
Calendar.setup ({
	inputField : "date_end", ifFormat : "<?php 
        echo $cal_dateformat;
        ?>
", showsTime : false, button : "date_end_trigger", singleClick : true, step : 1, weekNumbers:false
});
</script>
</div>
</p>
	<?php 
        // draw table
        echo "<P align='center'>" . $this->gen_xml($datax, $dateXml[0], $dateXml[1], $ids, $cache_file_name, $refresh, 'hBarF', $current_module_strings) . "</P>";
        echo "<P align='center'><span class='chartFootnote'>" . $current_module_strings['LBL_SALES_STAGE_FORM_DESC'] . "</span></P>";
        if (file_exists($cache_file_name)) {
            $file_date = $timedate->asUser($timedate->fromTimestamp(filemtime($cache_file_name)));
        } else {
            $file_date = '';
        }
        ?>

<span class='chartFootnote'>
<p align="right"><i><?php 
        echo $current_module_strings['LBL_CREATED_ON'] . ' ' . $file_date;
        ?>
</i></p>
</span>
<?php 
        echo get_validate_chart_js();
    }
	<form name="addToPB" method="POST" id="addToPB">
	   <tr>
		<td align="center">&nbsp;
			<input name="pricebook_id" type="hidden" value="' . $pricebook_id . '">
			<input name="idlist" type="hidden">
			<input name="viewname" type="hidden">
	';
//we should not display the Add to PriceBook button if there is no products to associate
if ($num_rows != $num_prod_rows && $num_rows > 0) {
    $other_text .= '<input class="crmbutton small save" type="submit" value="' . $mod_strings[LBL_ADD_PRICEBOOK_BUTTON_LABEL] . '" onclick="return addtopricebook()"/>';
}
$other_text .= '&nbsp;<input title="' . $app_strings[LBL_CANCEL_BUTTON_TITLE] . '" accessKey="' . $app_strings[LBL_CANCEL_BUTTON_KEY] . '" class="crmbutton small cancel" onclick="window.history.back()" type="button" name="button" value="' . $app_strings[LBL_CANCEL_BUTTON_LABEL] . '"></td>';
$other_text .= '
	   </tr>
	</table>';
$smarty->assign("PRODUCTLISTHEADER", get_form_header($current_module_strings['LBL_LIST_FORM_TITLE'], $other_text, false));
//Retreive the List View Table Header
$list_header = '';
$list_header .= '<tr>';
$list_header .= '<td class="lvtCol"><input type="checkbox" name="selectall" onClick=\'toggleSelect(this.checked,"selected_id");updateAllListPrice()\'></td>';
$list_header .= '<td class="lvtCol">' . $mod_strings['LBL_LIST_PRODUCT_NAME'] . '</td>';
if (getFieldVisibilityPermission('Products', $current_user->id, 'productcode') == '0') {
    $list_header .= '<td class="lvtCol">' . $mod_strings['LBL_PRODUCT_CODE'] . '</td>';
}
if (getFieldVisibilityPermission('Products', $current_user->id, 'unit_price') == '0') {
    $list_header .= '<td class="lvtCol">' . $mod_strings['LBL_PRODUCT_UNIT_PRICE'] . '</td>';
}
$list_header .= '<td class="lvtCol">' . $mod_strings['LBL_PB_LIST_PRICE'] . '</td>';
$list_header .= '</tr>';
$smarty->assign("LISTHEADER", $list_header);
//if the product is not associated already then we should display that products
    if ($id_hash < 0) {
        $id_hash = $id_hash * -1;
    }
}
$GLOBALS['log']->debug("ids is:");
$GLOBALS['log']->debug($ids);
$id_md5 = substr(md5($current_user->id), 0, 9);
$seps = array("-", "/");
$dates = array($dateStartDisplay, $dateEndDisplay);
$dateFileNameSafe = str_replace($seps, "_", $dates);
$cache_file_name = sugar_cached("xml/") . $current_user->getUserPrivGuid() . "_" . $theme . "_my_pipeline_" . $dateFileNameSafe[0] . "_" . $dateFileNameSafe[1] . ".xml";
$GLOBALS['log']->debug("cache file name is: {$cache_file_name}");
$tools = '<div align="right"><a href="index.php?module=' . $currentModule . '&action=' . $action . '&mypbss_refresh=true" class="tabFormAdvLink">' . SugarThemeRegistry::current()->getImage('refresh', 'border="0" align="absmiddle"', null, null, '.gif', $mod_strings['LBL_REFRESH']) . '&nbsp;' . $current_module_strings['LBL_REFRESH'] . '</a>&nbsp;&nbsp;<a href="javascript: toggleDisplay(\'my_pipeline_edit\');" class="tabFormAdvLink">' . SugarThemeRegistry::current()->getImage('edit', 'border="0" align="absmiddle"', null, null, '.gif', $mod_strings['LBL_EDIT']) . '&nbsp;' . $current_module_strings['LBL_EDIT'] . '</a></div>';
?>
	<?php 
echo get_form_header($mod_strings['LBL_PIPELINE_FORM_TITLE'], $tools, false);
?>

<?php 
global $timedate;
$cal_lang = "en";
$cal_dateformat = $timedate->get_cal_date_format();
?>
<p>
<div id='my_pipeline_edit' style='display: none;'>
<form name='my_pipeline' action="index.php" method="post" >
<input type="hidden" name="module" value="<?php 
echo $currentModule;
?>
">
<input type="hidden" name="action" value="<?php 
 /**
  * search
  *
  * Search function run when user goes to Show All and runs a search again.  This outputs the search results
  * calling upon the various listview display functions for each module searched on.
  * 
  * Todo: Sync this up with SugarSpot.php search method.
  *
  *
  */
 function search()
 {
     $unified_search_modules = $this->getUnifiedSearchModules();
     $unified_search_modules_display = $this->getUnifiedSearchModulesDisplay();
     require_once 'include/ListView/ListViewSmarty.php';
     global $modListHeader, $beanList, $beanFiles, $current_language, $app_strings, $current_user, $mod_strings;
     $home_mod_strings = return_module_language($current_language, 'Home');
     $this->query_string = $GLOBALS['db']->quote(securexss(from_html(clean_string($this->query_string, 'UNIFIED_SEARCH'))));
     if (!empty($_REQUEST['advanced']) && $_REQUEST['advanced'] != 'false') {
         $modules_to_search = array();
         if (!empty($_REQUEST['search_modules'])) {
             foreach (explode(',', $_REQUEST['search_modules']) as $key) {
                 if (isset($unified_search_modules_display[$key]) && !empty($unified_search_modules_display[$key]['visible'])) {
                     $modules_to_search[$key] = $beanList[$key];
                 }
             }
         }
         $current_user->setPreference('showGSDiv', isset($_REQUEST['showGSDiv']) ? $_REQUEST['showGSDiv'] : 'no', 0, 'search');
         $current_user->setPreference('globalSearch', $modules_to_search, 0, 'search');
         // save selections to user preference
     } else {
         $users_modules = $current_user->getPreference('globalSearch', 'search');
         $modules_to_search = array();
         if (!empty($users_modules)) {
             // use user's previous selections
             foreach ($users_modules as $key => $value) {
                 if (isset($unified_search_modules_display[$key]) && !empty($unified_search_modules_display[$key]['visible'])) {
                     $modules_to_search[$key] = $beanList[$key];
                 }
             }
         } else {
             foreach ($unified_search_modules_display as $module => $data) {
                 if (!empty($data['visible'])) {
                     $modules_to_search[$module] = $beanList[$module];
                 }
             }
         }
         $current_user->setPreference('globalSearch', $modules_to_search, 'search');
     }
     $templateFile = 'modules/Home/UnifiedSearchAdvancedForm.tpl';
     if (file_exists('custom/' . $templateFile)) {
         $templateFile = 'custom/' . $templateFile;
     }
     echo $this->getDropDownDiv($templateFile);
     $module_results = array();
     $module_counts = array();
     $has_results = false;
     if (!empty($this->query_string)) {
         foreach ($modules_to_search as $moduleName => $beanName) {
             require_once $beanFiles[$beanName];
             $seed = new $beanName();
             $lv = new ListViewSmarty();
             $lv->lvd->additionalDetails = false;
             $mod_strings = return_module_language($current_language, $seed->module_dir);
             //retrieve the original list view defs and store for processing in case of custom layout changes
             require 'modules/' . $seed->module_dir . '/metadata/listviewdefs.php';
             $orig_listViewDefs = $listViewDefs;
             if (file_exists('custom/modules/' . $seed->module_dir . '/metadata/listviewdefs.php')) {
                 require 'custom/modules/' . $seed->module_dir . '/metadata/listviewdefs.php';
             }
             if (!isset($listViewDefs) || !isset($listViewDefs[$seed->module_dir])) {
                 continue;
             }
             $unifiedSearchFields = array();
             $innerJoins = array();
             foreach ($unified_search_modules[$moduleName]['fields'] as $field => $def) {
                 $listViewCheckField = strtoupper($field);
                 //check to see if the field is in listview defs
                 if (empty($listViewDefs[$seed->module_dir][$listViewCheckField]['default'])) {
                     //check to see if field is in original list view defs (in case we are using custom layout defs)
                     if (!empty($orig_listViewDefs[$seed->module_dir][$listViewCheckField]['default'])) {
                         //if we are here then the layout has been customized, but the field is still needed for query creation
                         $listViewDefs[$seed->module_dir][$listViewCheckField] = $orig_listViewDefs[$seed->module_dir][$listViewCheckField];
                     }
                 }
                 //bug: 34125 we might want to try to use the LEFT JOIN operator instead of the INNER JOIN in the case we are
                 //joining against a field that has not been populated.
                 if (!empty($def['innerjoin'])) {
                     if (empty($def['db_field'])) {
                         continue;
                     }
                     $innerJoins[$field] = $def;
                     $def['innerjoin'] = str_replace('INNER', 'LEFT', $def['innerjoin']);
                 }
                 if (isset($seed->field_defs[$field]['type'])) {
                     $type = $seed->field_defs[$field]['type'];
                     if ($type == 'int' && !is_numeric($this->query_string)) {
                         continue;
                     }
                 }
                 $unifiedSearchFields[$moduleName][$field] = $def;
                 $unifiedSearchFields[$moduleName][$field]['value'] = $this->query_string;
             }
             /*
              * Use searchForm2->generateSearchWhere() to create the search query, as it can generate SQL for the full set of comparisons required
              * generateSearchWhere() expects to find the search conditions for a field in the 'value' parameter of the searchFields entry for that field
              */
             require_once $beanFiles[$beanName];
             $seed = new $beanName();
             require_once $this->searchFormPath;
             $searchForm = new $this->searchFormClass($seed, $moduleName);
             $searchForm->setup(array($moduleName => array()), $unifiedSearchFields, '', 'saved_views');
             $where_clauses = $searchForm->generateSearchWhere();
             //add inner joins back into the where clause
             $params = array('custom_select' => "");
             foreach ($innerJoins as $field => $def) {
                 if (isset($def['db_field'])) {
                     foreach ($def['db_field'] as $dbfield) {
                         $where_clauses[] = $dbfield . " LIKE '" . $this->query_string . "%'";
                     }
                     $params['custom_select'] .= ", {$dbfield}";
                     $params['distinct'] = true;
                     //$filterFields[$dbfield] = $dbfield;
                 }
             }
             if (count($where_clauses) > 0) {
                 $where = '((' . implode(' ) OR ( ', $where_clauses) . '))';
             } else {
                 /* Clear $where from prev. module
                    if in current module $where_clauses */
                 $where = '';
             }
             $displayColumns = array();
             foreach ($listViewDefs[$seed->module_dir] as $colName => $param) {
                 if (!empty($param['default']) && $param['default'] == true) {
                     $param['url_sort'] = true;
                     //bug 27933
                     $displayColumns[$colName] = $param;
                 }
             }
             if (count($displayColumns) > 0) {
                 $lv->displayColumns = $displayColumns;
             } else {
                 $lv->displayColumns = $listViewDefs[$seed->module_dir];
             }
             $lv->export = false;
             $lv->mergeduplicates = false;
             $lv->multiSelect = false;
             $lv->delete = false;
             $lv->select = false;
             $lv->showMassupdateFields = false;
             $lv->email = false;
             $lv->setup($seed, 'include/ListView/ListViewNoMassUpdate.tpl', $where, $params, 0, 10);
             $module_results[$moduleName] = '<br /><br />' . get_form_header($GLOBALS['app_list_strings']['moduleList'][$seed->module_dir] . ' (' . $lv->data['pageData']['offsets']['total'] . ')', '', false);
             $module_counts[$moduleName] = $lv->data['pageData']['offsets']['total'];
             if ($lv->data['pageData']['offsets']['total'] == 0) {
                 //$module_results[$moduleName] .= "<li class='noBullet' id='whole_subpanel_{$moduleName}'><div id='div_{$moduleName}'><h2>" . $home_mod_strings['LBL_NO_RESULTS_IN_MODULE'] . '</h2></div></li>';
                 $module_results[$moduleName] .= '<h2>' . $home_mod_strings['LBL_NO_RESULTS_IN_MODULE'] . '</h2>';
             } else {
                 $has_results = true;
                 //$module_results[$moduleName] .= "<li class='noBullet' id='whole_subpanel_{$moduleName}'><div id='div_{$moduleName}'>" . $lv->display(false, false) . '</div></li>';
                 $module_results[$moduleName] .= $lv->display(false, false);
             }
         }
     }
     if ($has_results) {
         foreach ($module_counts as $name => $value) {
             echo $module_results[$name];
         }
     } else {
         if (empty($_REQUEST['form_only'])) {
             echo $home_mod_strings['LBL_NO_RESULTS'];
             echo $home_mod_strings['LBL_NO_RESULTS_TIPS'];
         }
     }
 }
示例#24
0
 /**
 * @return void
 * @param unknown $seed
 * @param unknown $xTemplateSection
 * @param unknown $html_varName
 * @desc PUBLIC FUNCTION Handles List views using seeds that extend SugarBean
     $XTemplateSection is the section in the XTemplate file that should be parsed usually main
     $html_VarName is the variable name used in the XTemplateFile e.g. TASK
     $seed is a seed there are two types of seeds one is a subclass of SugarBean, the other is a list usually created from a sugar bean using get_list
     if no XTemplate is set it will create  a new XTemplate
     * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
     * All Rights Reserved..
     * Contributor(s): ______________________________________..
 */
 function processListViewTwo($seed, $xTemplateSection, $html_varName)
 {
     global $current_user;
     if (!isset($this->xTemplate)) {
         $this->createXTemplate();
     }
     $isSugarBean = is_subclass_of($seed, "SugarBean");
     $list = null;
     if ($isSugarBean) {
         $list = $this->processSugarBean($xTemplateSection, $html_varName, $seed);
     } else {
         $list = $seed;
     }
     if (is_object($seed) && isset($seed->object_name) && $seed->object_name == 'WorkFlow') {
         $tab = array();
         $access = get_workflow_admin_modules_for_user($current_user);
         for ($i = 0; $i < count($list); $i++) {
             if (!empty($access[$list[$i]->base_module])) {
                 $tab[] = $list[$i];
             }
         }
         $list = $tab;
     }
     if ($this->is_dynamic) {
         $this->processHeaderDynamic($xTemplateSection, $html_varName);
         $this->processListRows($list, $xTemplateSection, $html_varName);
     } else {
         $this->processSortArrows($html_varName);
         if ($isSugarBean) {
             $seed->parse_additional_headers($this->xTemplate, $xTemplateSection);
         }
         $this->xTemplateAssign('CHECKALL', "<img src='" . SugarThemeRegistry::current()->getImageURL('blank.gif') . "' width=\"1\" height=\"1\" al=\"\">");
         // Process the  order by before processing the pro_nav.  The pro_nav requires the order by values to be set
         $this->processOrderBy($html_varName);
         $this->processListRows($list, $xTemplateSection, $html_varName);
     }
     if ($this->display_header_and_footer) {
         $this->getAdditionalHeader();
         if (!empty($this->header_title)) {
             echo get_form_header($this->header_title, $this->header_text, false);
         }
     }
     $this->xTemplate->out($xTemplateSection);
     if (isset($_SESSION['validation'])) {
         print base64_decode('PGEgaHJlZj0naHR0cDovL3d3dy5zdWdhcmNybS5jb20nPlBPV0VSRUQmbmJzcDtCWSZuYnNwO1NVR0FSQ1JNPC9hPg==');
     }
 }
示例#25
0
    function distributionForm($where)
    {
        global $app_list_strings;
        global $app_strings;
        global $mod_strings;
        global $theme;
        global $current_user;
        $distribution = get_select_options_with_id($app_list_strings['dom_email_distribution'], '');
        $_SESSION['distribute_where'] = $where;
        $out = '<form name="Distribute" id="Distribute">';
        $out .= get_form_header($mod_strings['LBL_DIST_TITLE'], '', false);
        $out .= <<<eoq
\t\t<script>
\t\t\tenableQS(true);
\t\t</script>
eoq;
        $out .= '
		<table cellpadding="0" cellspacing="0" width="100%" border="0">
			<tr>
				<td>
					<script type="text/javascript">


						function checkDeps(form) {
							return;
						}

						function mySubmit() {
							var assform = document.getElementById("Distribute");
							var select = document.getElementById("userSelect");
							var assign1 = assform.r1.checked;
							var assign2 = assform.r2.checked;
							var dist = assform.dm.value;
							var assign = false;
							var users = false;
							var rules = false;
							var warn1 = "' . $mod_strings['LBL_WARN_NO_USERS'] . '";
							var warn2 = "";

							if(assign1 || assign2) {
								assign = true;

							}

							for(i=0; i<select.options.length; i++) {
								if(select.options[i].selected == true) {
									users = true;
									warn1 = "";
								}
							}

							if(dist != "") {
								rules = true;
							} else {
								warn2 = "' . $mod_strings['LBL_WARN_NO_DIST'] . '";
							}

							if(assign && users && rules) {

								if(document.getElementById("r1").checked) {
									var mu = document.getElementById("MassUpdate");
									var grabbed = "";

									for(i=0; i<mu.elements.length; i++) {
										if(mu.elements[i].type == "checkbox" && mu.elements[i].checked && mu.elements[i].name.value != "massall") {
											if(grabbed != "") { grabbed += "::"; }
											grabbed += mu.elements[i].value;
										}
									}
									var formgrab = document.getElementById("grabbed");
									formgrab.value = grabbed;
								}
								assform.submit();
							} else {
								alert("' . $mod_strings['LBL_ASSIGN_WARN'] . '" + "\\n" + warn1 + "\\n" + warn2);
							}
						}

						function submitDelete() {
							if(document.getElementById("r1").checked) {
								var mu = document.getElementById("MassUpdate");
								var grabbed = "";

								for(i=0; i<mu.elements.length; i++) {
									if(mu.elements[i].type == "checkbox" && mu.elements[i].checked && mu.elements[i].name != "massall") {
										if(grabbed != "") { grabbed += "::"; }
										grabbed += mu.elements[i].value;
									}
								}
								var formgrab = document.getElementById("grabbed");
								formgrab.value = grabbed;
							}
							if(grabbed == "") {
								alert("' . $mod_strings['LBL_MASS_DELETE_ERROR'] . '");
							} else {
								document.getElementById("Distribute").submit();
							}
						}

					</script>
						<input type="hidden" name="module" value="Emails">
						<input type="hidden" name="action" id="action">
						<input type="hidden" name="grabbed" id="grabbed">

					<table cellpadding="1" cellspacing="0" width="100%" border="0" class="edit view">
						<tr height="20">
							<td scope="col" scope="row" NOWRAP align="center">
								&nbsp;' . $mod_strings['LBL_ASSIGN_SELECTED_RESULTS_TO'] . '&nbsp;';
        $out .= $this->userSelectTable();
        $out .= '</td>
							<td scope="col" scope="row" NOWRAP align="left">
								&nbsp;' . $mod_strings['LBL_USING_RULES'] . '&nbsp;
								<select name="distribute_method" id="dm" onChange="checkDeps(this.form);">' . $distribution . '</select>
							</td>';
        $out .= '</td>
							</tr>';
        $out .= '<tr>
								<td scope="col" width="50%" scope="row" NOWRAP align="right" colspan="2">
								<input title="' . $mod_strings['LBL_BUTTON_DISTRIBUTE_TITLE'] . '"
									id="dist_button"
									accessKey="' . $mod_strings['LBL_BUTTON_DISTRIBUTE_KEY'] . '"
									class="button" onClick="AjaxObject.detailView.handleAssignmentDialogAssignAction();"
									type="button" name="button"
									value="  ' . $mod_strings['LBL_BUTTON_DISTRIBUTE'] . '  ">';
        $out .= '</tr>
					</table>
				</td>
			</tr>
		</table>
		</form>';
        return $out;
    }
示例#26
0
 /**
  * Called when Dashlet is displayed
  *
  * @param string $text text after the title
  * @return string Header html
  */
 public function getHeader($text = '')
 {
     global $sugar_config;
     $title = '<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td width="99%">' . $text . '</td>';
     $title .= $this->setConfigureIcon();
     $title .= $this->setRefreshIcon();
     $title .= $this->setDeleteIcon();
     $str = '<div ';
     if (empty($sugar_config['lock_homepage']) || $sugar_config['lock_homepage'] == false) {
         $str .= 'onmouseover="this.style.cursor = \'move\';" ';
     }
     $str .= 'id="dashlet_header_' . $this->id . '" class="hd"><div class="tl"></div><div class="hd-center">' . get_form_header($this->title, $title, false) . '</div><div class="tr"></div></div><div class="bd"><div class="ml"></div><div class="bd-center">';
     return $str;
 }
示例#27
0
$form->assign('THEME', $theme);
$form->assign('MODULE_NAME', $currentModule);
$form->assign('NAME', $name);
$form->assign('DOCUMENT_NAME', $document_name);
$form->assign('DOCUMENT_TARGET', $_REQUEST['target']);
$form->assign('DOCUMENT_REVISION_ID', $document_revision_id);
//$form->assign('request_data', $request_data);
$form->assign("CATEGORY_OPTIONS", get_select_options_with_id($app_list_strings['document_category_dom'], $category_id));
$form->assign("SUB_CATEGORY_OPTIONS", get_select_options_with_id($app_list_strings['document_subcategory_dom'], $subcategory_id));
$form->assign("IS_TEMPLATE_OPTIONS", get_select_options_with_id($app_list_strings['checkbox_dom'], $is_template));
$form->assign("TEMPLATE_TYPE_OPTIONS", get_select_options_with_id($app_list_strings['document_template_type_dom'], $template_type));
ob_start();
insert_popup_header($theme);
$output_html .= ob_get_contents();
ob_end_clean();
$output_html .= get_form_header($current_mod_strings['LBL_SEARCH_FORM_TITLE'], '', false);
$form->parse('main.SearchHeader');
$output_html .= $form->text('main.SearchHeader');
// Reset the sections that are already in the page so that they do not print again later.
$form->reset('main.SearchHeader');
// create the listview
$seed_bean = BeanFactory::getBean('Documents');
$ListView = new ListView();
$ListView->show_export_button = false;
$ListView->process_for_popups = true;
$ListView->setXTemplate($form);
$ListView->setHeaderTitle($current_mod_strings['LBL_LIST_FORM_TITLE']);
$ListView->setHeaderText($button);
$ListView->setQuery($where, '', 'document_name', 'DOCUMENT');
$ListView->setModStrings($current_mod_strings);
ob_start();
示例#28
0
if ($is_edit) {
    $edit_button = "<form name='EditView' method='POST' action='index.php'>\n";
    $edit_button .= "<input type='hidden' name='module' value='Releases'>\n";
    $edit_button .= "<input type='hidden' name='record' value='{$focus->id}'>\n";
    $edit_button .= "<input type='hidden' name='action'>\n";
    $edit_button .= "<input type='hidden' name='edit'>\n";
    $edit_button .= "<input type='hidden' name='isDuplicate'>\n";
    $edit_button .= "<input type='hidden' name='return_module' value='Releases'>\n";
    $edit_button .= "<input type='hidden' name='return_action' value='index'>\n";
    $edit_button .= "<input type='hidden' name='return_id' value=''>\n";
    $edit_button .= '<input title="' . $app_strings['LBL_SAVE_BUTTON_TITLE'] . '" accessKey="' . $app_strings['LBL_SAVE_BUTTON_KEY'] . '" class="button" onclick="this.form.action.value=\'Save\'; return check_form(\'EditView\');" type="submit" name="button" value="  ' . $app_strings['LBL_SAVE_BUTTON_LABEL'] . '  " >';
    $edit_button .= ' <input title="' . $app_strings['LBL_SAVE_NEW_BUTTON_TITLE'] . '" accessKey="' . $app_strings['LBL_SAVE_NEW_BUTTON_KEY'] . '" class="button" onclick="this.form.action.value=\'Save\'; this.form.isDuplicate.value=\'true\'; this.form.edit.value=\'true\'; this.form.return_action.value=\'EditView\'; return check_form(\'EditView\')" type="submit" name="button" value="  ' . $app_strings['LBL_SAVE_NEW_BUTTON_LABEL'] . '  " >';
    if ((is_admin($current_user) || is_admin_for_module($GLOBALS['current_user'], 'Bugs')) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])) {
        $header_text = "&nbsp;<a href='index.php?action=index&module=DynamicLayout&edit=true&from_action=EditView&from_module=" . $_REQUEST['module'] . "'>" . SugarThemeRegistry::current()->getImage("EditLayout", "border='0' alt='Edit Layout' align='bottom'") . "</a>";
    }
    echo get_form_header($mod_strings['LBL_RELEASE'] . " " . $focus->name . '&nbsp;' . $header_text, $edit_button, false);
    $GLOBALS['log']->info("Releases edit view");
    $xtpl = new XTemplate('modules/Releases/EditView.html');
    $xtpl->assign("MOD", $mod_strings);
    $xtpl->assign("APP", $app_strings);
    if (isset($_REQUEST['return_module'])) {
        $xtpl->assign("RETURN_MODULE", $_REQUEST['return_module']);
    }
    if (isset($_REQUEST['return_action'])) {
        $xtpl->assign("RETURN_ACTION", $_REQUEST['return_action']);
    }
    if (isset($_REQUEST['return_id'])) {
        $xtpl->assign("RETURN_ID", $_REQUEST['return_id']);
    }
    $xtpl->assign("PRINT_URL", "index.php?" . $GLOBALS['request_string']);
    $xtpl->assign("JAVASCRIPT", get_set_focus_js());
function template_calendar($args)
{
    global $timedate;
    if (isset($args['size']) && $args['size'] == 'small') {
        $args['calendar']->show_activities = false;
        $args['calendar']->show_week_on_month_view = false;
    }
    $newargs = array();
    $newargs['view'] = $args['view'];
    $newargs['calendar'] = $args['calendar'];
    if (!isset($args['size']) || $args['size'] != 'small') {
        template_cal_tabs($newargs);
    }
    if (isset($_REQUEST['view']) && $_REQUEST['view'] == 'shared') {
        global $ids;
        global $current_user;
        global $mod_strings;
        global $app_list_strings, $current_language, $currentModule, $action, $app_strings;
        $current_module_strings = return_module_language($current_language, 'Calendar');
        $ids = array();
        $user_ids = $current_user->getPreference('shared_ids');
        //get list of user ids for which to display data
        if (!empty($user_ids) && count($user_ids) != 0 && !isset($_REQUEST['shared_ids'])) {
            $ids = $user_ids;
        } elseif (isset($_REQUEST['shared_ids']) && count($_REQUEST['shared_ids']) > 0) {
            $ids = $_REQUEST['shared_ids'];
            $current_user->setPreference('shared_ids', $_REQUEST['shared_ids']);
        } else {
            //$ids = get_user_array(false);
            //$ids = array_keys($ids);
            $ids = array($current_user->id);
        }
        //get team id for which to display user list
        $tools = '<div align="right"><a href="index.php?module=' . $currentModule . '&action=' . $action . '&view=shared" class="tabFormAdvLink">&nbsp;<a href="javascript: toggleDisplay(\'shared_cal_edit\');" class="tabFormAdvLink">' . SugarThemeRegistry::current()->getImage('edit', 'alt="' . $current_module_strings['LBL_EDIT'] . '"  border="0"  align="absmiddle"') . '&nbsp;' . $current_module_strings['LBL_EDIT'] . '</a></div>';
        echo get_form_header($mod_strings['LBL_SHARED_CAL_TITLE'], $tools, false);
        if (empty($_SESSION['shared_ids'])) {
            $_SESSION['shared_ids'] = "";
        }
        echo "\n\t\t\t<script language=\"javascript\">\n\t\t\tfunction up(name) {\n\t\t\t\tvar td = document.getElementById(name+'_td');\n\t\t\t\tvar obj = td.getElementsByTagName('select')[0];\n\t\t\t\tobj =(typeof obj == \"string\") ? document.getElementById(obj) : obj;\n\t\t\t\tif(obj.tagName.toLowerCase() != \"select\" && obj.length < 2)\n\t\t\t\t\treturn false;\n\t\t\t\tvar sel = new Array();\n\n\t\t\t\tfor(i=0; i<obj.length; i++) {\n\t\t\t\t\tif(obj[i].selected == true) {\n\t\t\t\t\t\tsel[sel.length] = i;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor(i in sel) {\n\t\t\t\t\tif(sel[i] != 0 && !obj[sel[i]-1].selected) {\n\t\t\t\t\t\tvar tmp = new Array(obj[sel[i]-1].text, obj[sel[i]-1].value);\n\t\t\t\t\t\tobj[sel[i]-1].text = obj[sel[i]].text;\n\t\t\t\t\t\tobj[sel[i]-1].value = obj[sel[i]].value;\n\t\t\t\t\t\tobj[sel[i]].text = tmp[0];\n\t\t\t\t\t\tobj[sel[i]].value = tmp[1];\n\t\t\t\t\t\tobj[sel[i]-1].selected = true;\n\t\t\t\t\t\tobj[sel[i]].selected = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction down(name) {\n\t\t\t\tvar td = document.getElementById(name+'_td');\n\t\t\t\tvar obj = td.getElementsByTagName('select')[0];\n\t\t\t\tif(obj.tagName.toLowerCase() != \"select\" && obj.length < 2)\n\t\t\t\t\treturn false;\n\t\t\t\tvar sel = new Array();\n\t\t\t\tfor(i=obj.length-1; i>-1; i--) {\n\t\t\t\t\tif(obj[i].selected == true) {\n\t\t\t\t\t\tsel[sel.length] = i;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor(i in sel) {\n\t\t\t\t\tif(sel[i] != obj.length-1 && !obj[sel[i]+1].selected) {\n\t\t\t\t\t\tvar tmp = new Array(obj[sel[i]+1].text, obj[sel[i]+1].value);\n\t\t\t\t\t\tobj[sel[i]+1].text = obj[sel[i]].text;\n\t\t\t\t\t\tobj[sel[i]+1].value = obj[sel[i]].value;\n\t\t\t\t\t\tobj[sel[i]].text = tmp[0];\n\t\t\t\t\t\tobj[sel[i]].value = tmp[1];\n\t\t\t\t\t\tobj[sel[i]+1].selected = true;\n\t\t\t\t\t\tobj[sel[i]].selected = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t</script>\n\n\t\t\t<div id='shared_cal_edit' style='display: none;'>\n\t\t\t<form name='shared_cal' action=\"index.php\" method=\"post\" >\n\t\t\t<input type=\"hidden\" name=\"module\" value=\"" . $currentModule . "\">\n\t\t\t<input type=\"hidden\" name=\"action\" value=\"" . $action . "\">\n\t\t\t<input type=\"hidden\" name=\"view\" value=\"shared\">\n\t\t\t<input type=\"hidden\" name=\"edit\" value=\"0\">\n\t\t\t<table cellpadding=\"0\" cellspacing=\"3\" border=\"0\" align=\"center\">\n\t\t\t<tr><th valign=\"top\"  align=\"center\" colspan=\"2\">\n\t\t\t";
        echo $current_module_strings['LBL_SELECT_USERS'];
        echo "\n\t\t\t</th>\n\t\t\t</tr>\n\t\t\t<tr><td valign=\"top\">";
        echo "\n            </td><td valign=\"top\">\n\n\t\t\t<table cellpadding=\"1\" cellspacing=\"1\" border=\"0\" class=\"edit view\" align=\"center\">\n\t\t\t<tr>\n\t\t\t\t<td valign='top' nowrap><b>" . $current_module_strings['LBL_USERS'] . "</b></td>\n\t\t\t\t<td valign='top' id=\"shared_ids_td\"><select id=\"shared_ids\" name=\"shared_ids[]\" multiple size='3'>";
        echo get_select_options_with_id(get_user_array(false), $ids);
        echo "\t</select></td>\n\t\t\t\t<td><a onclick=\"up('shared_ids');\">" . SugarThemeRegistry::current()->getImage('uparrow_big', 'border="0" style="margin-bottom: 1px;" alt="' . $app_strings['LBL_SORT'] . '"') . "</a><br>\n\t\t\t\t<a onclick=\"down('shared_ids');\">" . SugarThemeRegistry::current()->getImage('downarrow_big', 'border="0" style="margin-top: 1px;"  alt="' . $app_strings['LBL_SORT'] . '"') . "</a></td>\n\t\t\t</tr>\n\t\t\t<tr>";
        echo "<td align=\"right\" colspan=\"2\"><input class=\"button\" type=\"submit\" title=\"" . $app_strings['LBL_SELECT_BUTTON_TITLE'] . "\" accessKey=\"" . $app_strings['LBL_SELECT_BUTTON_KEY'] . "\" value=\"" . $app_strings['LBL_SELECT_BUTTON_LABEL'] . "\" /><input class=\"button\" onClick=\"javascript: toggleDisplay('shared_cal_edit');\" type=\"button\" title=\"" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "\" accessKey=\"" . $app_strings['LBL_CANCEL_BUTTON_KEY'] . "\" value=\"" . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . "\"/></td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t</td></tr>\n\t\t\t</table>\n\t\t\t</form>";
    }
    // end "shared" view
    echo "</div></p>";
    if (isset($_REQUEST['edit']) && $_REQUEST['edit']) {
        echo " <script language=\"javascript\"> toggleDisplay('shared_cal_edit'); </script>";
    }
    echo "\n\t\t<table id=\"daily_cal_table_outside\" width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"monthBox\">\n\t\t<tr>\n\t\t<td>\n\t\t  <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"monthHeader\">\n\t\t  <tr>\n\t\t  <td width=\"1%\" nowrap>";
    if (!isset($args['size']) || $args['size'] != 'small') {
        template_get_previous_calendar($args);
    }
    echo "\n\t\t  </td>\n\t\t  <td width=\" 98 % \" align=center scope='row'>";
    if (isset($args['size']) && ($args['size'] = 'small')) {
        ?>
		<a style="text-decoration: none;"
			href="index.php?module=Calendar&action=index&view=month<?php 
        echo $args['calendar']->date_time->get_date_str();
        ?>
">
<?php 
    }
    ?>
<h3>
<?php 
    template_echo_date_info($args['view'], $args['calendar']->date_time);
    ?>
</h3>
<?php 
    if (isset($args['size']) && ($args['size'] = 'small')) {
        echo "</a>";
    }
    ?>

  </td>
  <td align="right" width="1%" nowrap><?php 
    if (!isset($args['size']) || $args['size'] != 'small') {
        template_get_next_calendar($args);
    }
    ?>
 </td>
  </tr>
  </table>
</td>
</tr>
<tr>
<td class="monthCalBody">
<?php 
    if ($args['calendar']->view == 'month') {
        template_calendar_month($args);
    } else {
        if ($args['calendar']->view == 'year') {
            template_calendar_year($args);
        } else {
            if ($args['calendar']->view == 'shared') {
                global $current_user, $shared_user;
                $shared_args = array();
                foreach ($args as $key => $val) {
                    $shared_args[$key] = $val;
                }
                $shared_args['calendar'] = $args['calendar'];
                $shared_user = new User();
                foreach ($ids as $member) {
                    $shared_user->retrieve($member);
                    $shared_args['calendar']->show_tasks = true;
                    $shared_args['calendar']->add_activities($shared_user);
                    $shared_args['show_link'] = 'off';
                    if ($shared_user->id == $current_user->id) {
                        $shared_args['show_link'] = 'on';
                    }
                    echo '<h5 class="calSharedUser">' . $shared_user->full_name . '</h5>';
                    template_calendar_horizontal($shared_args);
                }
            } else {
                template_calendar_vertical($args);
            }
        }
    }
    ?>
</td>
</tr>
<tr>
<td>
  <table width="100%" cellspacing="0" cellpadding="0" class="monthFooter">
  <tr>
  <td width="50%"><?php 
    template_get_previous_calendar($args);
    ?>
</td>
  <td align="right" width="50%"><?php 
    template_get_next_calendar($args);
    ?>
</td>
  </tr>
  </table>

</td>
</tr>
</table>
<?php 
}
示例#30
0
    function mass_assign($event, $arguments)
    {
        $action = $_REQUEST['action'];
        $module = $_REQUEST['module'];
        $no_mass_assign_list = array("Emails" => "Emails", "ACLRoles" => "ACLRoles");
        //,"Users"=>"Users");
        //check if security suite enabled
        $action = strtolower($action);
        if (isset($module) && ($action == "list" || $action == "index" || $action == "listview") && (!isset($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] != true) && !array_key_exists($module, $no_mass_assign_list)) {
            global $current_user;
            if (is_admin($current_user) || ACLAction::getUserAccessLevel($current_user->id, "SecurityGroups", 'access') == ACL_ALLOW_ENABLED) {
                require_once 'modules/SecurityGroups/SecurityGroup.php';
                $groupFocus = new SecurityGroup();
                $security_modules = $groupFocus->getSecurityModules();
                //if(in_array($module,$security_modules)) {
                if (in_array($module, array_keys($security_modules))) {
                    global $app_strings;
                    global $current_language;
                    $current_module_strings = return_module_language($current_language, 'SecurityGroups');
                    $form_header = get_form_header($current_module_strings['LBL_MASS_ASSIGN'], '', false);
                    $groups = $groupFocus->get_list("name", "", 0, -99, -99);
                    $options = array("" => "");
                    foreach ($groups['list'] as $group) {
                        $options[$group->id] = $group->name;
                    }
                    $group_options = get_select_options_with_id($options, "");
                    $mass_assign = <<<EOQ

<script type="text/javascript" language="javascript">
function confirm_massassign(del,start_string, end_string) {
\tif (del == 1) {
\t\treturn confirm( start_string + sugarListView.get_num_selected()  + end_string);
\t}
\telse {
\t\treturn confirm( start_string + sugarListView.get_num_selected()  + end_string);
\t}
}

function send_massassign(mode, no_record_txt, start_string, end_string, del) {

\tif(!sugarListView.confirm_action(del, start_string, end_string))
\t\treturn false;

\tif(document.MassAssign_SecurityGroups.massassign_group.selectedIndex == 0) {
\t\talert("Please select a group and try again.");
\t\treturn false;\t
\t}
\t 
\tif (document.MassUpdate.select_entire_list &&
\t\tdocument.MassUpdate.select_entire_list.value == 1)
\t\tmode = 'entire';
\telse if (document.MassUpdate.massall.checked == true)
\t\tmode = 'page';
\telse
\t\tmode = 'selected';

\tvar ar = new Array();
\tif(del == 1) {
\t\tvar deleteInput = document.createElement('input');
\t\tdeleteInput.name = 'Delete';
\t\tdeleteInput.type = 'hidden';
\t\tdeleteInput.value = true;
\t\tdocument.MassAssign_SecurityGroups.appendChild(deleteInput);
\t}

\tswitch(mode) {
\t\tcase 'page':
\t\t\tdocument.MassAssign_SecurityGroups.uid.value = '';
\t\t\tfor(wp = 0; wp < document.MassUpdate.elements.length; wp++) {
\t\t\t\tif(typeof document.MassUpdate.elements[wp].name != 'undefined'
\t\t\t\t\t&& document.MassUpdate.elements[wp].name == 'mass[]' && document.MassUpdate.elements[wp].checked) {
\t\t\t\t\t\t\tar.push(document.MassUpdate.elements[wp].value);
\t\t\t\t}
\t\t\t}
\t\t\tdocument.MassAssign_SecurityGroups.uid.value = ar.join(',');
\t\t\tif(document.MassAssign_SecurityGroups.uid.value == '') {
\t\t\t\talert(no_record_txt);
\t\t\t\treturn false;
\t\t\t}
\t\t\tbreak;
\t\tcase 'selected':
\t\t\tfor(wp = 0; wp < document.MassUpdate.elements.length; wp++) {
\t\t\t\tif(typeof document.MassUpdate.elements[wp].name != 'undefined'
\t\t\t\t\t&& document.MassUpdate.elements[wp].name == 'mass[]'
\t\t\t\t\t\t&& document.MassUpdate.elements[wp].checked) {
\t\t\t\t\t\t\tar.push(document.MassUpdate.elements[wp].value);
\t\t\t\t}
\t\t\t}
\t\t\tif(document.MassAssign_SecurityGroups.uid.value != '') document.MassAssign_SecurityGroups.uid.value += ',';
\t\t\tdocument.MassAssign_SecurityGroups.uid.value += ar.join(',');
\t\t\tif(document.MassAssign_SecurityGroups.uid.value == '') {
\t\t\t\talert(no_record_txt);
\t\t\t\treturn false;
\t\t\t}
\t\t\tbreak;
\t\tcase 'entire':
\t\t\tvar entireInput = document.createElement('input');
\t\t\tentireInput.name = 'entire';
\t\t\tentireInput.type = 'hidden';
\t\t\tentireInput.value = 'index';
\t\t\tdocument.MassAssign_SecurityGroups.appendChild(entireInput);
\t\t\t//confirm(no_record_txt);
\t\t\tbreak;
\t}

\tdocument.MassAssign_SecurityGroups.submit();
\treturn false;
}

</script>

\t\t<form action='index.php' method='post' name='MassAssign_SecurityGroups'  id='MassAssign_SecurityGroups'>
\t\t\t<input type='hidden' name='action' value='MassAssign' />
\t\t\t<input type='hidden' name='module' value='SecurityGroups' />
\t\t\t<input type='hidden' name='return_action' value='{$action}' />
\t\t\t<input type='hidden' name='return_module' value='{$module}' />
\t\t\t<textarea style='display: none' name='uid'></textarea>


\t\t<div id='massassign_form'>{$form_header}
\t\t<table cellpadding='0' cellspacing='0' border='0' width='100%'>
\t\t<tr>
\t\t<td style='padding-bottom: 2px;' class='listViewButtons'>
\t\t<input type='submit' name='Assign' value='{$current_module_strings['LBL_ASSIGN']}' onclick="return send_massassign('selected', '{$app_strings['LBL_LISTVIEW_NO_SELECTED']}','{$current_module_strings['LBL_ASSIGN_CONFIRM']}','{$current_module_strings['LBL_CONFIRM_END']}',0);" class='button'>
\t\t<input type='submit' name='Remove' value='{$current_module_strings['LBL_REMOVE']}' onclick="return send_massassign('selected', '{$app_strings['LBL_LISTVIEW_NO_SELECTED']}','{$current_module_strings['LBL_REMOVE_CONFIRM']}','{$current_module_strings['LBL_CONFIRM_END']}',1);" class='button'>


\t\t</td></tr></table>
\t\t<table cellpadding='0' cellspacing='0' border='0' width='100%' class='tabForm' id='mass_update_table'>
\t\t<tr><td><table width='100%' border='0' cellspacing='0' cellpadding='0'>
\t\t<tr>
\t\t<td>{$current_module_strings['LBL_GROUP']}</td>
\t\t<td><select name='massassign_group' id="massassign_group" tabindex='1'>{$group_options}</select></td>
\t\t</tr>
\t\t</table></td></tr></table></div>\t\t\t
\t\t</form>\t\t
EOQ;
                    echo $mass_assign;
                }
            }
        }
        //if after a save...
        if (!empty($_SESSION['securitysuite_error'])) {
            $lbl_securitysuite_error = $_SESSION['securitysuite_error'];
            unset($_SESSION['securitysuite_error']);
            echo <<<EOQ
<script>
\t\t\t\t

var oNewP = document.createElement("div");
oNewP.className = 'error';

var oText = document.createTextNode("{$lbl_securitysuite_error}");
oNewP.appendChild(oText);

var beforeMe = document.getElementsByTagName("div")[0];
document.body.insertBefore(oNewP, beforeMe);
</script>
EOQ;
        }
    }