Ejemplo n.º 1
0
 /**
  * Constructor.
  * @param array the data to be iterated through
  */
 public function __construct(TMap $map, $startIndex, $count)
 {
     $this->_map = $map;
     $this->_index = 0;
     $this->_startIndex = $startIndex;
     if ($startIndex + $count > $map->getCount()) {
         $this->_count = $map->getCount() - $startIndex;
     } else {
         $this->_count = $count;
     }
     $this->_iterator = $map->getIterator();
 }
Ejemplo n.º 2
0
 /**
  * Determines whether a property can be read.
  * This method overrides parent implementation by returning true
  * if the collection contains the named key.
  * @param string the property name
  * @return boolean whether the property can be read
  */
 public function canGetProperty($name)
 {
     return $this->contains($name) || parent::canGetProperty($name);
 }
Ejemplo n.º 3
0
 /**
  * Generates a radio button list.
  * A radio button list is like a {@link checkBoxList check box list}, except that
  * it only allows single selection.
  * @param string $name name of the radio button list. You can use this name to retrieve
  * the selected value(s) once the form is submitted.
  * @param string $select selection of the radio buttons.
  * @param array $data value-label pairs used to generate the radio button list.
  * Note, the values will be automatically HTML-encoded, while the labels will not.
  * @param array $htmlOptions additional HTML options. The options will be applied to
  * each radio button input. The following special options are recognized:
  * <ul>
  * <li>template: string, specifies how each radio button is rendered. Defaults
  * to "{input} {label}", where "{input}" will be replaced by the generated
  * radio button input tag while "{label}" will be replaced by the corresponding radio button label,
  * {beginLabel} will be replaced by &lt;label&gt; with labelOptions, {labelTitle} will be replaced
  * by the corresponding radio button label title and {endLabel} will be replaced by &lt;/label&gt;</li>
  * <li>separator: string, specifies the string that separates the generated radio buttons. Defaults to new line (<br/>).</li>
  * <li>labelOptions: array, specifies the additional HTML attributes to be rendered
  * for every label tag in the list.</li>
  * <li>container: string, specifies the radio buttons enclosing tag. Defaults to 'span'.
  * If the value is an empty string, no enclosing tag will be generated</li>
  * <li>baseID: string, specifies the base ID prefix to be used for radio buttons in the list.
  * This option is available since version 1.1.13.</li>
  * <li>empty: string, specifies the text corresponding to empty selection. Its value is empty.
  * The 'empty' option can also be an array of value-label pairs.
  * Each pair will be used to render a radio button at the beginning. Note, the text label will NOT be HTML-encoded.
  * This option is available since version 1.1.14.</li>
  * </ul>
  * @return string the generated radio button list
  */
 public static function radioButtonList($name, $select, $data, $htmlOptions = array())
 {
     $template = isset($htmlOptions['template']) ? $htmlOptions['template'] : '{input} {label}';
     $separator = isset($htmlOptions['separator']) ? $htmlOptions['separator'] : self::tag('br');
     $container = isset($htmlOptions['container']) ? $htmlOptions['container'] : 'span';
     unset($htmlOptions['template'], $htmlOptions['separator'], $htmlOptions['container']);
     $labelOptions = isset($htmlOptions['labelOptions']) ? $htmlOptions['labelOptions'] : array();
     unset($htmlOptions['labelOptions']);
     if (isset($htmlOptions['empty'])) {
         if (!is_array($htmlOptions['empty'])) {
             $htmlOptions['empty'] = array('' => $htmlOptions['empty']);
         }
         $data = TMap::mergeArray($htmlOptions['empty'], $data);
         unset($htmlOptions['empty']);
     }
     $items = array();
     $baseID = isset($htmlOptions['baseID']) ? $htmlOptions['baseID'] : self::getIdByName($name);
     unset($htmlOptions['baseID']);
     $id = 0;
     foreach ($data as $value => $labelTitle) {
         $checked = !strcmp($value, $select);
         $htmlOptions['value'] = $value;
         $htmlOptions['id'] = $baseID . '_' . $id++;
         $option = self::radioButton($name, $checked, $htmlOptions);
         $beginLabel = self::openTag('label', $labelOptions);
         $label = self::label($labelTitle, $htmlOptions['id'], $labelOptions);
         $endLabel = self::closeTag('label');
         $items[] = strtr($template, array('{input}' => $option, '{beginLabel}' => $beginLabel, '{label}' => $label, '{labelTitle}' => $labelTitle, '{endLabel}' => $endLabel));
     }
     if (empty($container)) {
         return implode($separator, $items);
     } else {
         return self::tag($container, array('id' => $baseID), implode($separator, $items));
     }
 }
Ejemplo n.º 4
0
        }
        $output .= $this->footer();
        header('Content-type: text/xml');
        echo $output;
        exit;
    }
    function header($cities)
    {
        $global = mysql_fetch_assoc(mysql_query('SELECT value FROM strings WHERE module="site" AND name="regions_map_global" AND lang="ru"'));
        if (!$global) {
            $global = 'color="CCCCCC" smap="1" zoom="3" smap_scale="50" smap_x="250" smap_y="140" bord_color="CCCCCC" bg_color="CCCCCC" f_color="FFFFFF"';
        } else {
            $global = $global['value'];
        }
        $str = '<?xml version="1.0" encoding="UTF-8" ?><global><global ' . $global . ' />';
        foreach ($cities as $city) {
            if ($city['visible'] > 0) {
                $str .= '<CITY x="' . $city['x'] . '" y="' . $city['y'] . '" name="' . iconv("WINDOWS-1251", "UTF-8", $city['name']) . '" ' . ($city['dealer'] ? 'type="dealer"' : '') . '/>';
            }
        }
        $str .= '</global>';
        return $str;
    }
    function footer()
    {
        return '';
    }
}
ini_set('display_errors', 0);
$m = new TMap();
$m->showMap();
 public function checkInputBDE($trackingId)
 {
     // load parameters
     $confFile = './protected/pages/components/timuxuser/config.xml';
     if (file_exists($confFile)) {
         $config = new TApplicationConfiguration();
         $config->loadFromFile($confFile);
         $param = new TMap();
         foreach ($config->getParameters() as $id => $parameter) {
             if (is_array($parameter)) {
                 $component = Prado::createComponent($parameter[0]);
                 foreach ($parameter[1] as $name => $value) {
                     $component->setSubProperty($name, $value);
                 }
                 $param->add($id, $component);
             } else {
                 $param->add($id, $parameter);
             }
         }
     } else {
         $param = Prado::getApplication()->getParameters();
     }
     $computation2 = $param['computation2'];
     if ($computation2 != '') {
         Prado::using('horux.pages.components.timuxuser.' . $computation2);
         if (class_exists($computation2)) {
             $extend = new $computation2();
             if ($extend) {
                 return $extend->checkInputBDE($trackingId);
             }
         }
     }
     return true;
 }
Ejemplo n.º 6
0
 public function testToArray()
 {
     $map = new TMap(array('key' => 'value'));
     self::assertEquals(array('key' => 'value'), $map->toArray());
 }