public static function getTypeOfAcceptor() { $types = ZHtml::enumItem(FamilyPlanningService::model(), 'type_of_acceptor'); $types[''] = ''; asort($types); return $types; }
<?php echo $form->textField($model, 'birth_order', array('size' => 60, 'maxlength' => 255, 'class' => 'form-control')); ?> <?php echo $form->error($model, 'birth_order', array('class' => 'text-danger')); ?> </div> </div> <div class="form-group"> <?php echo $form->labelEx($model, 'place_of_delivery', array('class' => 'control-label col-sm-4')); ?> <div class="col-sm-8 radio"> <?php echo $form->radioButtonList($model, 'place_of_delivery', ZHtml::enumItem($model, 'place_of_delivery'), array('size' => 60, 'maxlength' => 255)); ?> <?php echo $form->error($model, 'place_of_delivery', array('class' => 'text-danger')); ?> </div> </div> <div class="form-group"> <?php echo $form->labelEx($model, 'mothers_name', array('class' => 'control-label col-sm-4')); ?> <div class="col-sm-8"> <?php echo $form->textField($model, 'mothers_name', array('size' => 60, 'maxlength' => 255, 'class' => 'form-control')); ?>
echo $form->errorSummary($model); ?> <?php echo $form->textFieldRow($model, 'email', array('maxlength' => 128)); ?> <?php echo $form->textFieldRow($model, 'firstname', array('maxlength' => 128)); ?> <?php echo $form->textFieldRow($model, 'lastname', array('maxlength' => 128)); ?> <?php echo $form->dropDownListRow($model, 'gender', ZHtml::enumItem($model, 'gender')); ?> <?php echo $form->passwordFieldRow($model, 'password', array('maxlength' => 128)); ?> <div class="form-actions"> <?php $this->widget('bootstrap.widgets.BootButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => $model->isNewRecord ? 'Create' : 'Save')); ?> </div> <?php $this->endWidget();
<?php echo $form->textField($model, 'contact_no', array('size' => 15, 'maxlength' => 15, 'class' => 'form-control')); ?> <?php echo $form->error($model, 'contact_no', array('class' => 'text-danger')); ?> </div> </div> <div class="form-group"> <?php echo $form->labelEx($model, 'gender', array('class' => 'control-label col-sm-3')); ?> <div class="col-sm-9"> <?php echo $form->dropDownList($model, 'gender', ZHtml::enumItem($model, 'gender'), array('class' => 'form-control')); ?> <?php echo $form->error($model, 'gender', array('class' => 'text-danger')); ?> </div> </div> <div class="form-group"> <?php echo $form->labelEx($model, 'height', array('class' => 'control-label col-sm-3')); ?> <div class="col-sm-9"> <?php echo $form->textField($model, 'height', array('class' => 'form-control')); ?>
public static function getGenders() { $genders = ZHtml::enumItem(Patient::model(), 'gender'); $genders[''] = ''; asort($genders); return $genders; }
<?php $server_types = ZHtml::enumItem(Servers::model(), 'server_type'); $select_types = array('' => '--Select Server Type--') + $server_types; ?> <div id="app-main-list" class="table-main" style="display:none";> <fieldset> <input type="hidden" id="app-main-list-csrf" value="<?php echo Yii::app()->request->csrfToken; ?> " /> <div class="table-header-block"> <div class="header-block-button"> <a id="app-main-list-create-button" class="button round blue image-right ic-add text-upper" href="#">Create Application</a> </div><!-- End Header Block Button --> <div class="header-block-side"> <div class="page-nav"> <div class="page-count"> <span class="current-page" id="app-main-list-part"></span> <span class="all-page" id="app-main-list-total"></span> </div> <div class="page-nav-arrow"> <a id="app-main-list-prev" class="prev" href="#" title="Previous"><span class="icon"></span></a> <a id="app-main-list-next" class="next" href="#" title="Next"><span class="icon"></span></a> </div> </div> </div><!-- End Header Block Side --> </div><!-- End Table Header Block -->
<?php // Items for dropdownlists $status = ZHtml::enumItem(Projects::model(), 'status'); // Add default blank value for search fields. $search_status = array('' => '') + $status; ?> <div id="projects-list" class="table-main" style="display:none"> <?php echo CHtml::form('', 'post', array('id' => 'export-form', 'enctype' => 'multipart/form-data')); ?> <fieldset> <input type="hidden" id="projects-list-csrf" value="<?php echo Yii::app()->request->csrfToken; ?> " /> <div class="table-header-block"> <div class="header-block-button"> <a id="projects-list-create-button" class="button round blue image-right ic-add text-upper" href="#">Create Project</a> </div><!-- End Header Block Button --> <div class="header-block-side"> <div class="page-nav"> <div class="page-count"> <span class="current-page" id="projects-list-part"></span> <span class="all-page" id="projects-list-total"></span> </div> <div class="page-nav-arrow"> <a id="projects-list-prev" class="prev" href="#" title="Previous"><span class="icon"></span></a> <a id="projects-list-next" class="next" href="#" title="Next"><span class="icon"></span></a>
public static function getReasonsForExamination() { $reasons = ZHtml::enumItem(NtpLaboratoryRequest::model(), 'reason_for_examination'); $reasons[''] = ''; asort($reasons); return $reasons; }
public static function getPositions() { $positions = ZHtml::enumItem(User::model(), 'position'); $positions[''] = ''; asort($positions); return $positions; }
public static function getPlaceOfDelivery() { $placeOfDelivery = ZHtml::enumItem(ChildHealth::model(), 'place_of_delivery'); $placeOfDelivery[''] = ''; asort($placeOfDelivery); return $placeOfDelivery; }
$form = $this->beginWidget('bootstrap.widgets.BootActiveForm', array('id' => 'activity-form', 'enableAjaxValidation' => false, 'type' => 'horizontal')); ?> <?php echo $form->errorSummary($model); ?> <?php echo $form->dropDownListRow($model, 'goalId', CHtml::listData($goals, 'id', 'description'), array('prompt' => 'Select a Goal')); ?> <?php echo $form->textFieldRow($model, 'description', array('maxlength' => 256)); ?> <?php echo $form->textFieldRow($model, 'day', array()); ?> <?php echo $form->dropDownListRow($model, 'status', ZHtml::enumItem($model, 'status')); ?> <div class="form-actions"> <?php $this->widget('bootstrap.widgets.BootButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => $model->isNewRecord ? 'Create' : 'Save')); ?> </div> <?php $this->endWidget();
public function actionUpdate() { $data = $_POST; //will be empty if CSRF authentication fails if (!empty($data)) { $data['name'] = trim($data['name']); $data['server_type'] = trim($data['server_type']); $data['hostname'] = trim($data['hostname']); $data['public_ip'] = trim($data['public_ip']); $data['private_ip'] = trim($data['private_ip']); $data['network'] = trim($data['network']); $data['location'] = trim($data['location']); $data['description'] = trim($data['description']); $data['production_date'] = trim($data['production_date']); $data['termination_date'] = trim($data['termination_date']); // making it null instead of an empty string will evade integrity constraint errors if (strlen($data['public_ip']) == 0) { $data['public_ip'] = null; } if (strlen($data['private_ip']) == 0) { $data['private_ip'] = null; } //FORM VALIDATION HERE $errors = array(); $duplicate = NULL; //name is required if (strlen($data['name']) == 0) { array_push($errors, 'NAME_ERROR: Name is required'); } //network is required if (strlen($data['network']) == 0) { array_push($errors, 'NETWORK_ERROR: Network is required'); } $server_types = ZHtml::enumItem(Servers::model(), 'server_type'); //server type is required if (strlen($data['server_type']) == 0) { array_push($errors, 'TYPE_ERROR: Type is required'); //server type should be valid } else { if (!in_array($data['server_type'], $server_types)) { array_push($errors, 'TYPE_ERROR: Type is invalid'); } } //public IP must be unique if (strlen($data['public_ip']) != 0) { $duplicate = Servers::model()->find('public_ip=:public_ip', array(':public_ip' => $data['public_ip'])); if ($duplicate != NULL && $duplicate->server_id != $data['server_id']) { array_push($errors, 'PUBLIC_ERROR: Public IP is already assigned'); } } //private IP + network must be unique if (strlen($data['private_ip']) != 0 && strlen($data['network']) != 0) { $duplicate = Servers::model()->find('private_ip=:private_ip AND network=:network', array(':private_ip' => $data['private_ip'], ':network' => $data['network'])); if ($duplicate != NULL && $duplicate->server_id != $data['server_id']) { array_push($errors, 'PRIVATE_ERROR: Private IP is already assigned'); } } //data is good if (count($errors) == 0) { $updates = array('name' => $data['name'], 'server_type' => $data['server_type'], 'hostname' => $data['hostname'], 'public_ip' => $data['public_ip'], 'private_ip' => $data['private_ip'], 'network' => $data['network'], 'location' => $data['location'], 'description' => $data['description'], 'production_date' => $data['production_date'], 'termination_date' => $data['termination_date'], 'date_updated' => date("Y-m-d H:i:s"), 'updated_by' => Yii::app()->user->name); Servers::model()->updateByPk((int) $data['server_id'], $updates); $updates['name'] = str_replace('<', '<', $updates['name']); $updates['hostname'] = str_replace('<', '<', $updates['hostname']); $updates['public_ip'] = str_replace('<', '<', $updates['public_ip']); $updates['private_ip'] = str_replace('<', '<', $updates['private_ip']); $updates['network'] = str_replace('<', '<', $updates['network']); $updates['location'] = str_replace('<', '<', $updates['location']); $updates['description'] = str_replace('<', '<', $updates['description']); echo CJSON::encode(array('type' => 'success', 'data' => $updates)); } else { echo CJSON::encode(array('type' => 'error', 'data' => implode(',', $errors), 'duplicate' => $duplicate)); } } else { echo CJSON::encode(array('type' => 'error', 'data' => 'CSRF_ERROR: CSRF Token did not match')); } }
echo $form->textArea($model, 'reason_for_practicing_fp', array('rows' => 6, 'cols' => 50, 'class' => 'form-control', 'style' => 'resize: none')); ?> <?php echo $form->error($model, 'reason_for_practicing_fp', array('class' => 'text-danger')); ?> </div> </div> <div class="form-group"> <?php echo $form->labelEx($model, 'type_of_acceptor', array('class' => 'control-label col-sm-4')); ?> <div class="col-sm-8"> <div class="radio"> <?php echo $form->radioButtonList($model, 'type_of_acceptor', ZHtml::enumItem($model, 'type_of_acceptor')); ?> </div> <?php echo $form->error($model, 'type_of_acceptor', array('class' => 'text-danger')); ?> </div> </div> <div class="form-group"> <?php echo $form->label($model, 'previous_method_used', array('class' => 'control-label col-sm-4')); ?> <div class="col-sm-8"> <?php echo $form->textArea($model, 'previous_method_used', array('rows' => 6, 'cols' => 50, 'class' => 'form-control', 'style' => 'resize: none'));
public static function enumDropDownList($model, $attribute, $htmlOptions) { return CHtml::activeDropDownList($model, $attribute, ZHtml::enumItem($model, $attribute), $htmlOptions); }
echo $form->textField($model, 'middle_name', array('maxlength' => 255, 'class' => 'form-control')); ?> <?php echo $form->error($model, 'middle_name', array('class' => 'text-danger')); ?> </div> </div> <div class="form-group"> <?php echo $form->labelEx($model, 'position', array('class' => 'control-label col-sm-3')); ?> <div class="col-sm-9"> <?php echo $form->dropDownList($model, 'position', ZHtml::enumItem($model, 'position'), array('maxlength' => 22, 'class' => 'form-control')); ?> <?php echo $form->error($model, 'position', array('class' => 'text-danger')); ?> </div> </div> <div class="form-group"> <?php echo $form->labelEx($model, 'birthdate', array('class' => 'control-label col-sm-3')); ?> <div class="col-sm-9"> <?php echo $form->dateField($model, 'birthdate', array('class' => 'form-control'));
<?php echo $form->textField($model, 'no_of_household_contacts', array('class' => 'form-control')); ?> <?php echo $form->error($model, 'no_of_household_contacts', array('class' => 'text-danger')); ?> </div> </div> <div class="form-group"> <?php echo $form->labelEx($model, 'classification_of_tb', array('class' => 'control-label col-sm-4')); ?> <div class="col-sm-8 radio"> <?php echo $form->radioButtonList($model, 'classification_of_tb', ZHtml::enumItem($model, 'classification_of_tb')); ?> <?php echo $form->error($model, 'classification_of_tb', array('class' => 'text-danger')); ?> </div> </div> <div class="form-group"> <?php echo $form->labelEx($model, 'tb_site', array('class' => 'control-label col-sm-4')); ?> <div class="col-sm-8"> <?php echo $form->textField($model, 'tb_site', array('class' => 'form-control')); ?>