Пример #1
0
        </select>
    </td>
</tr>
<tr id="group_row" style="display:none">
    <td align="right">
        <?php 
echo _('Group');
?>
:
    </td>
    <td>
        <select name="group_id">
            <option value="0">--------</option>
            <?php 
$stb_groups = new StbGroup();
$all_groups = $stb_groups->getAll();
foreach ($all_groups as $group) {
    echo '<option value="' . $group['id'] . '">' . $group['name'] . '</option>';
}
?>
        </select>
    </td>
</tr>
<tr>
    <td align="right">
        TYPE:
    </td>
    <td>        
        <select name="event" id="event" onchange="check_event()">
            <option value="">----------
            <option value="send_msg">send_msg
Пример #2
0
 private function buildUserForm(&$data = array(), $edit = FALSE)
 {
     $builder = $this->app['form.factory'];
     $additional_services = array(0 => $this->setLocalization('off'), 1 => $this->setLocalization('on'));
     $status = array(1 => $this->setLocalization('off'), 0 => $this->setLocalization('on'));
     $stb_groups = new \StbGroup();
     $all_groups = $stb_groups->getAll();
     $group_keys = $this->getFieldFromArray($all_groups, 'id');
     $group_names = $this->getFieldFromArray($all_groups, 'name');
     if (is_array($group_keys) && is_array($group_names) && count($group_keys) == count($group_names) && count($group_keys) > 0) {
         $all_groups = array_combine($group_keys, $group_names);
     } else {
         $all_groups = array(NULL);
     }
     if (!empty($data['id'])) {
         $tmp = $stb_groups->getMemberByUid($data['id']);
         if (!empty($tmp)) {
             $data['group_id'] = $tmp['stb_group_id'];
         }
         $tmp = $this->db->getUserFavItv($data['id']);
         if (!empty($tmp)) {
             $tmp = unserialize(base64_decode($tmp));
             $data['fav_itv'] = is_array($tmp) ? count($tmp) : 0;
             $data['fav_itv_on'] = $data['fav_itv'] ? 1 : 0;
         } else {
             $data['fav_itv'] = 0;
             $data['fav_itv_on'] = 0;
         }
         $data['version'] = str_replace("; ", ";", $data['version']);
         $data['version'] = str_replace(";", ";\r\n", $data['version']);
     }
     if ($this->app['tarifPlanFlag']) {
         $tarif_plans = $this->db->getAllTariffPlans();
         $plan_keys = $this->getFieldFromArray($tarif_plans, 'id');
         $plan_names = $this->getFieldFromArray($tarif_plans, 'name');
         if (is_array($plan_keys) && is_array($plan_names) && count($plan_keys) == count($plan_names) && count($plan_keys) > 0) {
             $tariff_plans = array_combine($plan_keys, $plan_names);
         } else {
             $tariff_plans = array(NULL);
         }
     }
     if (empty($this->app['reseller'])) {
         $resellers = array(array('id' => '-', 'name' => $this->setLocalization('Empty')));
         $resellers = array_merge($resellers, $this->db->getAllFromTable('reseller'));
         $resellers = array_combine($this->getFieldFromArray($resellers, 'id'), $this->getFieldFromArray($resellers, 'name'));
         if (empty($data['reseller_id'])) {
             $data['reseller_id'] = '-';
         }
     }
     $form = $builder->createBuilder('form', $data)->add('id', 'hidden')->add('fname', 'text', array('required' => FALSE))->add('login', 'text', $this->getAddUserFormParam($edit))->add('password', 'password', array('required' => FALSE))->add('phone', 'text', array('required' => FALSE))->add('ls', 'text', array('required' => FALSE))->add('group_id', 'choice', array('choices' => $all_groups, 'data' => !empty($data['group_id']) ? $data['group_id'] : NULL, 'required' => FALSE))->add('mac', 'text', $edit ? array('required' => FALSE, 'read_only' => TRUE, 'disabled' => TRUE) : array('required' => FALSE))->add('status', 'choice', array('choices' => $status, 'constraints' => array(new Assert\Choice(array('choices' => array_keys($status)))), 'required' => FALSE))->add('comment', 'textarea', array('required' => FALSE))->add('save', 'submit');
     //                ->add('reset', 'reset');
     if (!empty($data['id'])) {
         $form->add('ip', 'text', array('required' => FALSE, 'read_only' => TRUE, 'disabled' => TRUE))->add('parent_password', 'text', array('required' => FALSE, 'read_only' => TRUE, 'disabled' => TRUE))->add('settings_password', 'text', array('required' => FALSE, 'read_only' => TRUE, 'disabled' => TRUE))->add('fav_itv', 'text', array('required' => FALSE, 'read_only' => TRUE, 'disabled' => TRUE))->add('version', 'textarea', array('required' => FALSE, 'read_only' => TRUE, 'disabled' => TRUE))->add('account_balance', 'text', array('required' => FALSE, 'read_only' => TRUE, 'disabled' => TRUE));
     }
     if ($this->app['tarifPlanFlag']) {
         $form->add('tariff_plan_id', 'choice', array('choices' => $tariff_plans, 'constraints' => array(new Assert\Choice(array('choices' => array_keys($tariff_plans)))), 'required' => FALSE));
     } else {
         $form->add('additional_services_on', 'choice', array('choices' => $additional_services, 'constraints' => array(new Assert\Choice(array('choices' => array_keys($additional_services)))), 'required' => FALSE));
     }
     if (\Config::getSafe('enable_internal_billing', 'false')) {
         $form->add('expire_billing_date', 'text', array('required' => FALSE));
     }
     if (empty($this->app['reseller'])) {
         $form->add('reseller_id', 'choice', array('choices' => $resellers, 'constraints' => array(new Assert\Choice(array('choices' => array_keys($resellers)))), 'required' => FALSE));
     }
     return $form->getForm();
 }