public static function team(Team $team)
 {
     $forJSON = array("level" => $team->getLevel(), "experience" => $team->getExperience(), "money" => $team->getMoney(), "realMoney" => $team->getRealMoney(), "studyPoints" => $team->getStudyPoints(), "energy" => $team->getCurrentEnergy(), "energyMax" => floor($team->getEnergyMax()), "trainerId" => $team->getTrainerId(), "teamName" => $team->getTeamName(), "teamLogoId" => $team->getTeamLogoId(), "paramForward" => $team->getParameterForward(), "paramHalf" => $team->getParameterHalf(), "paramSafe" => $team->getParameterSafe(), "isInstalled" => $team->getIsInstalled(), "socialUserId" => $team->getSocialUserId(), "userPhoto" => $team->getUserPhoto(), "userName" => $team->getUserName(), "isInTeam" => $team->getIsInTeam(), "studyPointsViaPrize" => $team->getStudyPointsViaPrize(), "inGroup" => $team->getInGroup(), "counterChoose" => $team->getCounterChoose(), "counterWon" => $team->getCounterWon(), "counterLose" => $team->getCounterLose(), "stadiumId" => $team->getStadiumId(), "needDailyBonus" => $team->isNeedDailyBonus(), "placeCountry" => $team->getPlaceCountry(), "placeCity" => $team->getPlaceCity(), "placeUniversity" => $team->getPlaceUniversity(), "placeVK" => $team->getPlaceVK(), "tourIIIcounter" => $team->getTourIII(), "tourPlaceCountry" => $team->getTourPlaceCountry(), "tourPlaceCity" => $team->getTourPlaceCity(), "tourPlaceUniversity" => $team->getTourPlaceUniversity(), "tourPlaceVK" => $team->getTourPlaceVK(), "tourNotify" => $team->getTourNotify(), "tourBonus" => $team->getTourBonus(), "tourBonusTime" => $team->getTourBonusTime(), "counterChoose" => $team->getCounterChoose(), "counterWon" => $team->getCounterWon(), "counterLose" => $team->getCounterLose(), "totalPlace" => $team->getTotalPlace(), "place" => isset($team->place) ? $team->place : 99);
     if (count($team->getFootballers())) {
         $forJSON["footballers"] = JSONPrepare::footballers($team->getFootballers());
     }
     if (count($team->getSponsors())) {
         $forJSON["sponsors"] = JSONPrepare::sponsors($team->getSponsors());
     }
     return $forJSON;
 }
示例#2
0
 function fill_in_additional_detail_fields()
 {
     // jmorais@dri Bug #56269
     parent::fill_in_additional_detail_fields();
     // ~jmorais@dri
     global $locale;
     $query = "SELECT u1.first_name, u1.last_name from users  u1, users  u2 where u1.id = u2.reports_to_id AND u2.id = '{$this->id}' and u1.deleted=0";
     $result = $this->db->query($query, true, "Error filling in additional detail fields");
     $row = $this->db->fetchByAssoc($result);
     if ($row != null) {
         global $locale;
         $this->reports_to_name = $locale->formatName('Users', $row);
     } else {
         $this->reports_to_name = '';
     }
     // Must set team_id for team widget purposes (default_team is primary team id)
     if (empty($this->team_id)) {
         $this->team_id = $this->default_team;
     }
     //set the team info if the team id has already been set.
     //running only if team class exists will prevent breakage during upgrade/flavor conversions
     if (class_exists('Team')) {
         // Set default_team_name for Campaigns WebToLeadCreation
         $this->default_team_name = Team::getTeamName($this->team_id);
     } else {
         //if no team id exists, set the team info to blank
         $this->default_team = '';
         $this->default_team_name = '';
         $this->team_set_id = '';
     }
     $this->_create_proper_name_field();
 }
示例#3
0
 public function initFromRAM(Team $team)
 {
     $this->socialUserId = $team->getSocialUserId();
     $this->setLevel($team->getLevel());
     $this->setExperience($team->getExperience());
     $this->setMoney($team->getMoney());
     $this->setRealMoney($team->getRealMoney());
     $this->setStudyPoints($team->getStudyPoints());
     $this->setStudyPointsViaPrize($team->getStudyPointsViaPrize());
     $this->setInGroup($team->getInGroup());
     $this->setParameterForward($team->getParameterForward());
     $this->setParameterHalf($team->getParameterHalf());
     $this->setParameterSafe($team->getParameterSafe());
     $this->setEnergy($team->getCurrentEnergy());
     $this->setMaxEnergy($team->getEnergyMax());
     $this->trainerId = $team->getTrainerId();
     $this->teamName = trim($team->getTeamName());
     $this->teamLogoId = $team->getTeamLogoId();
     $this->inTeam = $team->getIsInTeam();
     $this->isAbleToChoose = $team->getIsAbleToChoose();
     $this->userPhoto = trim($team->getUserPhoto());
     $this->userName = trim($team->getUserName());
     $this->counterWon = $team->getCounterWon();
     $this->counterChoose = $team->getCounterChoose();
     $this->counterLose = $team->getCounterLose();
     $this->counterTie = $team->getCounterTie();
     $this->stadiumId = $team->getStadiumId();
     $this->setUserCountry($team->getUserCountry());
     $this->setUserCity($team->getUserCity());
     $this->setUserUniversity($team->getUserUniversity());
     $this->setPlaceCountry($team->getPlaceCountry());
     $this->setPlaceCity($team->getPlaceCity());
     $this->setPlaceUniversity($team->getPlaceUniversity());
     $this->setPlaceVK($team->getPlaceVK());
     $this->setTourIII($team->getTourIII());
     $this->setDailyBonus($team->isNeedDailyBonus());
     $this->setTourPlaceCountry($team->getTourPlaceCountry());
     $this->setTourPlaceCity($team->getTourPlaceCity());
     $this->setTourPlaceUniversity($team->getTourPlaceUniversity());
     $this->setTourPlaceVK($team->getTourPlaceVK());
     $this->setTourNotify($team->getTourNotify());
     $this->setTourBonus($team->getTourBonus());
     $this->setTourBonusTime($team->getTourBonusTime());
     $this->setIsPrized($team->getIsPrized());
     $this->setParameterSum($team->getParameterSum());
     $this->setTotalPlace($team->getTotalPlace());
     $this->setAllFootballersCount($team->getAllFootballersCount());
     $this->setAllFootballersFriendsCount($team->getAllFootballersFriendsCount());
     $this->setSponsorsCount($team->getSponsorsCount());
 }
示例#4
0
function get_assigned_team_name($assigned_team_id)
{
    if (!empty($GLOBALS['sugar_config']['disable_user_cache'])) {
        return Team::getTeamName($assigned_team_id);
    }
    static $team_list = null;
    if (empty($team_list)) {
        $team_list = get_team_array(false, "");
    }
    if (isset($team_list[$assigned_team_id])) {
        return $team_list[$assigned_team_id];
    }
    return "";
}
示例#5
0
 function process($checkFormName = false, $formName = '')
 {
     global $mod_strings, $sugar_config, $app_strings, $app_list_strings;
     //the retrieve already did this work;
     //$this->focus->fill_in_relationship_fields();
     //Bug#53261: If quickeditview is loaded after editview.tpl is created,
     //           the th->checkTemplate will return true. So, the following
     //           code prevent avoid rendering popup editview container.
     if (!empty($this->formName)) {
         $formName = $this->formName;
         $checkFormName = true;
     }
     if (!$this->th->checkTemplate($this->module, $this->view, $checkFormName, $formName)) {
         $this->render();
     }
     if (isset($_REQUEST['offset'])) {
         $this->offset = $_REQUEST['offset'] - 1;
     }
     if ($this->showVCRControl) {
         $this->th->ss->assign('PAGINATION', SugarVCR::menu($this->module, $this->offset, $this->focus->is_AuditEnabled(), $this->view == 'EditView'));
     }
     if (isset($_REQUEST['return_module'])) {
         $this->returnModule = $_REQUEST['return_module'];
     }
     if (isset($_REQUEST['return_action'])) {
         $this->returnAction = $_REQUEST['return_action'];
     }
     if (isset($_REQUEST['return_id'])) {
         $this->returnId = $_REQUEST['return_id'];
     }
     if (isset($_REQUEST['return_relationship'])) {
         $this->returnRelationship = $_REQUEST['return_relationship'];
     }
     if (isset($_REQUEST['return_name'])) {
         $this->returnName = $this->getValueFromRequest($_REQUEST, 'return_name');
     }
     // handle Create $module then Cancel
     if (empty($this->returnId)) {
         $this->returnAction = 'index';
     }
     $is_owner = $this->focus->isOwner($GLOBALS['current_user']->id);
     $this->fieldDefs = array();
     if ($this->focus) {
         global $current_user;
         if (!empty($this->focus->job) && $this->focus->job_function == '') {
             $this->focus->job_function = $this->focus->job;
         }
         if (empty($this->focus->team_id)) {
             $this->focus->team_id = $current_user->default_team;
             $this->focus->team_name = $current_user->default_team_name;
         } else {
             if (empty($this->focus->team_name)) {
                 $this->focus->team_name = Team::getTeamName($this->focus->team_id);
             }
         }
         foreach ($this->focus->toArray() as $name => $value) {
             $valueFormatted = false;
             //if ($this->focus->field_defs[$name]['type']=='link')continue;
             $this->fieldDefs[$name] = !empty($this->fieldDefs[$name]) && !empty($this->fieldDefs[$name]['value']) ? array_merge($this->focus->field_defs[$name], $this->fieldDefs[$name]) : $this->focus->field_defs[$name];
             foreach (array("formula", "default", "comments", "help") as $toEscape) {
                 if (!empty($this->fieldDefs[$name][$toEscape])) {
                     $this->fieldDefs[$name][$toEscape] = htmlentities($this->fieldDefs[$name][$toEscape], ENT_QUOTES, 'UTF-8');
                 }
             }
             if (isset($this->fieldDefs[$name]['options']) && isset($app_list_strings[$this->fieldDefs[$name]['options']])) {
                 if (isset($GLOBALS['sugar_config']['enable_autocomplete']) && $GLOBALS['sugar_config']['enable_autocomplete'] == true) {
                     $this->fieldDefs[$name]['autocomplete'] = true;
                     $this->fieldDefs[$name]['autocomplete_options'] = $this->fieldDefs[$name]['options'];
                     // we need the name for autocomplete
                 } else {
                     $this->fieldDefs[$name]['autocomplete'] = false;
                 }
                 // Bug 57472 - $this->fieldDefs[$name]['autocomplete_options' was set too late, it didn't retrieve the list's name, but the list itself (the developper comment show us that developper expected to retrieve list's name and not the options array)
                 $this->fieldDefs[$name]['options'] = $app_list_strings[$this->fieldDefs[$name]['options']];
             }
             if (isset($this->fieldDefs[$name]['options']) && is_array($this->fieldDefs[$name]['options']) && isset($this->fieldDefs[$name]['default_empty']) && !isset($this->fieldDefs[$name]['options'][$this->fieldDefs[$name]['default_empty']])) {
                 $this->fieldDefs[$name]['options'] = array_merge(array($this->fieldDefs[$name]['default_empty'] => $this->fieldDefs[$name]['default_empty']), $this->fieldDefs[$name]['options']);
             }
             if (isset($this->fieldDefs[$name]['function'])) {
                 $functionBean = isset($this->fieldDefs[$name]['function_bean']) ? $this->fieldDefs[$name]['function_bean'] : null;
                 $function = $this->fieldDefs[$name]['function'];
                 $functionArgs = array($this->focus, $name, $value, $this->view);
                 // since we are on the old edit view, we need to revert to the old way to get the currency
                 // drop down and not the new fancy way that REST needs to get it.
                 $setValueFormatted = false;
                 if ($function == 'getCurrencies' && $functionBean == 'Currencies') {
                     $function = array('returns' => 'html', 'name' => 'getCurrencyDropDown');
                     $functionBean = array();
                     $setValueFormatted = true;
                 }
                 $value = getFunctionValue($functionBean, $function, $functionArgs);
                 if ($setValueFormatted || !empty($this->fieldDefs[$name]['function']['returns']) && $this->fieldDefs[$name]['function']['returns'] == 'html') {
                     $valueFormatted = true;
                 } else {
                     $this->fieldDefs[$name]['options'] = $value;
                 }
             }
             if (isset($this->fieldDefs[$name]['type']) && $this->fieldDefs[$name]['type'] == 'function' && isset($this->fieldDefs[$name]['function_name'])) {
                 $value = $this->callFunction($this->fieldDefs[$name]);
                 $valueFormatted = true;
             }
             if (!$valueFormatted) {
                 // $this->focus->format_field($this->focus->field_defs[$name]);
                 $value = isset($this->focus->{$name}) ? $this->focus->{$name} : '';
             }
             if (empty($this->fieldDefs[$name]['value'])) {
                 $this->fieldDefs[$name]['value'] = $value;
             }
             //This code is used for QuickCreates that go to Full Form view.  We want to overwrite the values from the bean
             //with values from the request if they are set and either the bean is brand new (such as a create from a subpanels) or the 'full form' button has been clicked
             if (($this->populateBean && empty($this->focus->id) || isset($_REQUEST['full_form'])) && (!isset($this->fieldDefs[$name]['function']['returns']) || $this->fieldDefs[$name]['function']['returns'] != 'html') && isset($_REQUEST[$name])) {
                 $this->fieldDefs[$name]['value'] = $this->getValueFromRequest($_REQUEST, $name);
             }
             /*
              * Populate any relate fields that are linked by a relationship to the calling module.
              * Clicking the create button on a subpanel for example will populate three values in the $_REQUEST:
              * 1. return_module => the name of the calling module
              * 2. return_id => the id of the record in the calling module that the user was viewing and that should be associated with this new record
              * 3. return_name => the display value of the return_id record - the value to show in any relate field in this EditView
              * Only do if this fieldDef does not already have a value; if it does it will have been explicitly set, and that should overrule this less specific mechanism
              */
             if (isset($this->returnModule) && isset($this->returnName) && empty($this->focus->id) && empty($this->fieldDefs['name']['value'])) {
                 if ($this->focus->field_defs[$name]['type'] == 'relate' && isset($this->focus->field_defs[$name]['module']) && $this->focus->field_defs[$name]['module'] == $this->returnModule) {
                     if (isset($this->fieldDefs[$name]['id_name']) && !empty($this->returnRelationship) && isset($this->focus->field_defs[$this->fieldDefs[$name]['id_name']]['relationship']) && $this->returnRelationship == $this->focus->field_defs[$this->fieldDefs[$name]['id_name']]['relationship'] || !empty($this->fieldDefs[$name]['custom_module']) && !empty($this->focus->module_dir) && $this->focus->module_dir == $this->fieldDefs[$name]['custom_module']) {
                         $this->fieldDefs[$name]['value'] = $this->returnName;
                         // set the hidden id field for this relate field to the correct value i.e., return_id
                         $this->fieldDefs[$this->fieldDefs[$name]['id_name']]['value'] = $this->returnId;
                     }
                 }
             }
         }
         $this->focus->ACLFilterFieldList($this->fieldDefs, array(), array("add_acl" => true));
     }
     if (isset($this->focus->additional_meta_fields)) {
         $this->fieldDefs = array_merge($this->fieldDefs, $this->focus->additional_meta_fields);
     }
     if ($this->isDuplicate) {
         foreach ($this->fieldDefs as $name => $defs) {
             if (!empty($defs['auto_increment'])) {
                 $this->fieldDefs[$name]['value'] = '';
             }
         }
     }
 }