if ($isNextTimeWillBeDesc) { //if current state is asscending ,then prepare for the descending option $AppendOptions = array(); foreach ($options as $dropdownlistValue => $dropdownlistText) { $AppendOptions[$dropdownlistValue . '.desc'] = $dropdownlistText; } $options = $AppendOptions; } /** remain the selected sort option */ $selectedVal = ""; //default unselected if (isset($_GET[$name]) && !empty($_GET[$name])) { $selectedVal = $_GET[$name]; //replace .desc no matter it exist or not $selectedVal = str_replace('.desc', '', $selectedVal); foreach ($options as $dropdownlistValue => $dropdownlistText) { if (strpos($dropdownlistValue, $selectedVal) !== false) { $selectedVal = $dropdownlistValue; } } } JSHelper::SubmitOnDropDownListChange('#' . $dropdownlistId); ?> <div class="input-group input-group-sm col-xs-12 col-sm-4 col-md-3 col-lg-3"> <span class="input-group-addon">Sort</span> <?php echo CHtml::dropDownList($name, $selectedVal, $options, array('class' => 'form-control', 'id' => $dropdownlistId)); ?> </div><!-- filter item 1 -->
<?php /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ JSHelper::SubmitOnDropDownListChange('#GroupSelect'); $this->pageTitle = "組織管理 - 會員中心 - "; ?> <h4>組織管理</h4> <div class="panel"> <div class="panel-body"> <?php $form = $this->beginWidget('CActiveForm', array()); ?> <div class="row"> <div class="input-group input-group-sm col-xs-12 col-sm-4 col-md-3 col-lg-3"> <span class="input-group-addon">正在管理</span> <select id="GroupSelect" name="manageGroupId" class=" form-control"> <?php for ($i = 0; $i < count($ownedGroupArray); $i++) { $group = $ownedGroupArray[$i]; $isSelected = ""; if ($manageGroup->id == $group->id) { $isSelected = "selected"; } print "<option value='" . $group->id . "' " . $isSelected . ">" . $group->group_name . "</option>"; }