Example #1
0
 public function actionVieworders($id)
 {
     $user_id = Yii::app()->user->id;
     $criteria = new CDbCriteria();
     $criteria->condition = "citm_cart_id=:citm_cart_id AND cart_user_id=:cart_user_id";
     $criteria->params = array(':citm_cart_id' => $id, ':cart_user_id' => $user_id);
     $criteria->with = array('cartCartItem', 'cartItem');
     $criteria->order = 'citm_item_id asc';
     $model = CartItems::model()->findAll($criteria);
     $customizatiosData = array();
     if (!empty($model)) {
         foreach ($model as $key => $arrObj) {
             if (!empty($arrObj->citm_customization)) {
                 $customizations = json_decode($arrObj->citm_customization, true);
                 $customizatiosData[$arrObj->citm_id] = $customizations;
             }
         }
     }
     $fabricDetails = Fabrics::model()->findAll();
     $buttonDetails = Buttons::model()->findAll();
     $fabrics = array();
     if (!empty($fabricDetails)) {
         foreach ($fabricDetails as $key2 => $arr) {
             $fabId = $arr->fab_id;
             $fabrics[$fabId] = $arr;
         }
     }
     $buttons = CHtml::listData($buttonDetails, 'but_id', 'but_name');
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     $this->render('vieworders', array('model' => $model, 'fabrics' => $fabrics, 'buttons' => $buttons, 'customizatiosData' => $customizatiosData));
 }
    echo Form::control_group(Form::label('lng', 'Longitude'), Form::xlarge_text('lng', Input::old('lng')), 'error', Form::inline_help($errors->first('lng')));
} else {
    echo Form::control_group(Form::label('lng', 'Longitude'), Form::xlarge_text('lng', $marker->lng), '');
}
if ($errors->has('type')) {
    echo Form::control_group(Form::label('type', 'Type'), Form::xlarge_text('type', Input::old('type')), 'error', Form::inline_help($errors->first('type')));
} else {
    echo Form::control_group(Form::label('type', 'Type'), Form::xlarge_text('type', $marker->type), '');
}
if ($errors->has('img_input')) {
    echo Form::control_group(Form::label('img_input', 'Image'), Form::file('img_input'), Form::inline_help($errors->first('img_input')));
} else {
    echo Form::control_group(Form::label('img_input', 'Image'), Form::file('img_input'));
}
echo Form::control_group(Form::label('client', 'Client'), Form::select('client', $clients, $marker->user_id));
echo Form::actions(array(Buttons::success_submit('Edit'), Buttons::link_danger('Delete', '#myModal', array('role' => 'button', 'data-toggle' => 'modal'))));
?>
		
		</div>
		<div class="span5">
			<?php 
$value = isset($marker->rem1) ? $marker->rem1 : '';
echo Form::control_group(Form::label('rem1', 'Remarque #1'), Form::xlarge_textarea('rem1', $value, array('rows' => '2')));
$value = isset($marker->rem2) ? $marker->rem2 : '';
echo Form::control_group(Form::label('rem2', 'Remarque #2'), Form::xlarge_textarea('rem2', $value, array('rows' => '2')));
$value = isset($marker->rem3) ? $marker->rem3 : '';
echo Form::control_group(Form::label('rem3', 'Remarque #3'), Form::xlarge_textarea('rem3', $value, array('rows' => '2')));
$value = isset($marker->rem4) ? $marker->rem4 : '';
echo Form::control_group(Form::label('rem4', 'Remarque #4'), Form::xlarge_textarea('rem4', $value, array('rows' => '2')));
$value = isset($marker->rem5) ? $marker->rem5 : '';
echo Form::control_group(Form::label('rem5', 'Remarque #5'), Form::xlarge_textarea('rem5', $value, array('rows' => '2')));
Example #3
0
 public function actionAddbuttons($id)
 {
     if (empty($id)) {
         $this->redirect(array('index'));
     }
     $buttons = Buttons::model()->findAll();
     $model = $this->loadModel($id);
     $criteria = new CDbCriteria();
     $criteria->condition = 'fbt_fabric_id=:fbt_fabric_id';
     $criteria->params = array(':fbt_fabric_id' => $id);
     if (!empty($_POST)) {
         if (!empty($_POST['buttonids'])) {
             FabricButtons::model()->deleteAll($criteria);
             foreach ($_POST['buttonids'] as $key => $buttonId) {
                 $fabButtonModel = new FabricButtons();
                 $fabButtonModel->fbt_fabric_id = $id;
                 $fabButtonModel->fbt_button_id = $buttonId;
                 $fabButtonModel->save();
             }
         }
         Yii::app()->user->setFlash('success', 'Assigned successfully.');
         $this->redirect(array('addbuttons', 'id' => $id));
     }
     $fabriButtonsData = FabricButtons::model()->findAll($criteria);
     $fabriButtons = CHtml::listData($fabriButtonsData, 'fbt_id', 'fbt_button_id');
     $this->render('addbuttons', array('buttons' => $buttons, 'model' => $model, 'fabriButtons' => $fabriButtons));
 }
			@if(!empty($message))
				<div class="alert alert-success fade in">
					{{ $message }}
					<button type="button" class="close" data-dismiss="alert">×</button>
				</div>
			@endif
			{{ Form::horizontal_open() }}
			<div class="span5">

				<?php 
if ($errors->has('username')) {
    echo Form::control_group(Form::label('username', 'Société'), Form::xlarge_text('username', '', array('Placeholder' => 'Societe')), 'error', Form::inline_help($errors->first('username')));
} else {
    echo Form::control_group(Form::label('username', 'Société'), Form::xlarge_text('username', '', array('Placeholder' => 'Societe')), '');
}
if ($errors->has('password')) {
    echo Form::control_group(Form::label('password', 'Password'), Form::password('password', array('class' => 'input-large')), 'error'), Form::inline_help($errors->first('nom'));
} else {
    echo Form::control_group(Form::label('password', 'Password'), Form::password('password', array('class' => 'input-large')), '');
}
echo Form::control_group(Form::label('group', 'Groupe'), Form::select('group', array('1' => 'Admin', '2' => 'Client'), '2'));
echo Form::actions(array(Buttons::primary_submit('Create Client')));
?>
			
			</div>

			{{ Form::close() }}
		</div>
	</div>

@endsection
if ($errors->has('lng')) {
    echo Form::control_group(Form::label('lng', 'Longitude'), Form::xlarge_text('lng', Input::old('lng')), 'error', Form::inline_help($errors->first('lng')));
} else {
    echo Form::control_group(Form::label('lng', 'Longitude'), Form::xlarge_text('lng', Input::old('lng')), '');
}
if ($errors->has('type')) {
    echo Form::control_group(Form::label('type', 'Type'), Form::xlarge_text('type', Input::old('type')), 'error', Form::inline_help($errors->first('type')));
} else {
    echo Form::control_group(Form::label('type', 'Type'), Form::xlarge_text('type', Input::old('type')), '');
}
if ($errors->has('img_input')) {
    echo Form::control_group(Form::label('img_input', 'Image'), Form::file('img_input'), Form::inline_help($errors->first('img_input')));
} else {
    echo Form::control_group(Form::label('img_input', 'Image'), Form::file('img_input'));
}
echo Form::actions(array(Buttons::success_submit('Add new')));
?>
			</div>
			<div class="span4">
				<?php 
$value = isset($marker->rem1) ? $marker->rem1 : '';
echo Form::control_group(Form::label('rem1', 'Remarque #1'), Form::xmedium_textarea('rem1', Input::old('rem1'), array('rows' => '2')));
$value = isset($marker->rem2) ? $marker->rem2 : '';
echo Form::control_group(Form::label('rem2', 'Remarque #2'), Form::xmedium_textarea('rem2', Input::old('rem2'), array('rows' => '2')));
$value = isset($marker->rem3) ? $marker->rem3 : '';
echo Form::control_group(Form::label('rem3', 'Remarque #3'), Form::xmedium_textarea('rem3', Input::old('rem3'), array('rows' => '2')));
$value = isset($marker->rem4) ? $marker->rem4 : '';
echo Form::control_group(Form::label('rem4', 'Remarque #4'), Form::xmedium_textarea('rem4', Input::old('rem4'), array('rows' => '2')));
$value = isset($marker->rem5) ? $marker->rem5 : '';
echo Form::control_group(Form::label('rem5', 'Remarque #5'), Form::xmedium_textarea('rem5', Input::old('rem5'), array('rows' => '2')));
?>
Example #6
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Buttons::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 public function testAllTheThings()
 {
     $control = Former::text('foo')->state('error')->inlineHelp('foo')->blockHelp('bar')->prepend('@', '$', Buttons::normal('foo'))->append('@', '$', Buttons::normal('foo'))->__toString();
     $matcher = '<div class="control-group error">' . '<label for="foo" class="control-label">Foo</label>' . '<div class="controls">' . '<div class="input-prepend input-append">' . '<span class="add-on">@</span>' . '<span class="add-on">$</span>' . '<button type="button" class="btn">foo</button>' . '<input type="text" name="foo" id="foo">' . '<span class="add-on">@</span>' . '<span class="add-on">$</span>' . '<button type="button" class="btn">foo</button>' . '</div>' . '<span  class="help-inline">Foo</span>' . '<p  class="help-block">Bar</p>' . '</div>' . '</div>';
     $this->assertEquals($matcher, $control);
 }