public function store(StoreOptionsRequest $request)
 {
     /* Retrieve current data from database, If there is current data, then there will only be ONE row.
      * Otherwise, we will create a row and insert the data provided by the user.
      */
     $opts = Options::first();
     if ($opts === null) {
         $opts = new Options();
     }
     /* Simply set the month and year of current issue */
     $opts->current_year = Input::get('year');
     $opts->current_month = Input::get('month');
     if ($opts->save()) {
         return Redirect::to('/admin/');
     } else {
         $years = [];
         /* Set years options to a range of from 5 years ago to 5 years
          * into the future.
          */
         for ($i = Carbon::now()->format('Y') - 5; $i < Carbon::now()->format('Y') + 5; $i++) {
             $years[] = $i;
         }
         $months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
         /* The current issue's month and year as retrieved from database */
         $selected = ['month' => $opts->month, 'year' => $opts->year];
         return View::make('admin.options', ['error' => 'Unable to save data to database!', 'options' => $opts, 'months' => $months, 'years' => $years, 'selected' => $selected]);
     }
 }
Example #2
0
 public function index()
 {
     $options = Options::first();
     //dd($options);
     $issue = Issues::where('year', $options->current_year)->where('month', $options->current_month)->first();
     //dd($issue);
     return View::make('index', ['issue' => $issue]);
 }
Example #3
0
 public function index()
 {
     $navFlag = 'home';
     $introduce = Cache::store('redis')->remember('options.introduce', 10, function () {
         $value = Options::where('name', 'introduce')->value('value');
         return $value;
     });
     return view('index.index', compact('navFlag', 'introduce'));
 }
Example #4
0
 public function index()
 {
     $options = Options::first();
     //dd($options);
     $current = Issues::where('year', $options->current_year)->where('month', $options->current_month)->first();
     //dd($current);
     $issues = Issues::all();
     return View::make('issues', ['current' => $current, 'issues' => $issues, 'months' => Config::get('months')]);
 }
 public function coverUpdate(Request $request)
 {
     $data['name'] = 'introduce';
     $data['value'] = $request->input('introduce');
     $instance = Options::updateOrCreate(['name' => 'introduce'], $data);
     if (false !== $instance) {
         return redirect()->back();
     }
 }
Example #6
0
 public function addDataForView()
 {
     $this->data['options'] = Options::where('options_group_id', 2)->get()->toArray();
     $options = [];
     while ($option = array_shift($this->data['options'])) {
         $options[$option['code']] = $option;
     }
     $this->data['options'] = $options;
     $this->menu = Pages::where('show_in_menu', 1)->where('active', 1)->orderBy('sort', 'asc')->get()->toArray();
     $this->data['pageData'] = new \stdClass();
 }
 public function create()
 {
     $opts = Options::first();
     /* Set years options to a range of from 5 years ago to 5 years
      * into the future.
      */
     $years = [];
     for ($i = Carbon::now()->format('Y') - 5; $i < Carbon::now()->format('Y') + 5; $i++) {
         $years[] = $i;
     }
     return View::make('admin.issues.add', ['error' => 'none', 'year' => Carbon::now()->format('Y'), 'months' => Config::get('months')]);
 }
 public function registerDi()
 {
     $this->container['systemOptions'] = function ($c) {
         return new OptionsFacade(Options::where('options_group_id', 1)->get());
     };
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Eloquent::unguard();
     Options::create(['art' => 'FrontPageArtJanuary15', 'banner' => 'FrontPageBannerJanuary15', 'month' => 'January', 'year' => '15']);
 }
Example #10
0
            <div class="ui divider"></div>
            <div class="row">
                <div class="col-lg-4 col-md-4 col-sm-12">
                    <?php 
$remarks = [['value' => 10, 'desc' => 'For Evaluation'], ['value' => 0, 'desc' => 'Passed'], ['value' => 1, 'desc' => 'Failed']];
?>
                    <?php 
echo $form->field($model, 'remarks', ['inputTemplate' => '<label for="Remarks">Remarks</label>{input}', 'inputOptions' => []])->dropDownList(ArrayHelper::map($remarks, 'value', 'desc'), ['class' => 'form-control pva-form-control'])->label(false);
?>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-4 col-md-4 col-sm-12">
                    <?php 
echo $form->field($model, 'recommendations', ['inputTemplate' => '<label for="Recommendations">Recommendations</label>{input}', 'inputOptions' => []])->dropDownList([10 => 'For Evaluation', 0 => 'Promoted', 1 => 'Retained'], ['class' => 'form-control pva-form-control'])->label(false);
?>
                </div>
            </div>
        </div>
    </div>
    <div class="three wide rounded column">
        <div class="column">
            <?php 
echo Options::render(['scenario' => Yii::$app->controller->action->id, 'id' => $model->id, 'exist' => false]);
?>
        </div>
    </div>
</div>
<?php 
ActiveForm::end();
echo $this->render('/layouts/_toast', ['model' => $model]);
 public function controls($type = NULL, $model = NULL)
 {
     return ['from' => \Easy\Form\Textbox::make('~layouts.form.controls.textboxes.textbox')->name('from')->caption('From')->placeholder('Give please accurate address including post code')->class('form-control data-source')->controlsource('from')->controltype('textbox')->out(), 'from_nr' => \Easy\Form\Textbox::make('~layouts.form.controls.textboxes.textbox')->name('from_nr')->caption('Pick up')->ng_model('form.from_nr')->placeholder('postcode: (NR1 to NR7 only), house number,street')->class('form-control data-source')->controlsource('from_nr')->controltype('textbox')->value($model != NULL ? $model->name : '')->out(), 'to' => \Easy\Form\Textbox::make('~layouts.form.controls.textboxes.textbox')->name('to')->caption('To')->placeholder('Give please accurate address including post code')->class('form-control data-source')->controlsource('to')->controltype('textbox')->out(), 'to_nr' => \Easy\Form\Textbox::make('~layouts.form.controls.textboxes.textbox')->name('to_nr')->caption('To')->ng_model('form.to_nr')->placeholder('postcode: (NR1 to NR7 only), house number,street')->class('form-control data-source')->controlsource('to_nr')->controltype('textbox')->value($model != NULL ? $model->name : '')->out(), 'locality' => \Easy\Form\Textbox::make('~layouts.form.controls.textboxes.textbox')->name('locality')->caption('City')->class('form-control data-source')->controlsource('locality')->controltype('textbox')->out(), 'country' => \Easy\Form\Textbox::make('~layouts.form.controls.textboxes.textbox')->name('country')->caption('Country')->class('form-control data-source')->controlsource('country')->controltype('textbox')->out(), 'postal_code' => \Easy\Form\Textbox::make('~layouts.form.controls.textboxes.textbox-addon')->name('postal_code')->caption('Postal code')->class('form-control data-source')->readonly(0)->controlsource('postal_code')->controltype('textbox')->addon(['before' => '<i class="fa fa-envelope"></i>', 'after' => NULL])->out(), 'options' => \Easy\Form\Combobox::make('~layouts.form.controls.comboboxes.combobox')->name('option')->caption('Pick-up Point:')->class('form-control data-source input-group form-select selectpicker init-on-update-delete')->controlsource('option')->controltype('combobox')->enabled('false')->options(['' => '- Select -'] + Options::toCombobox())->out(), 'airport' => \Easy\Form\Combobox::make('~layouts.form.controls.comboboxes.combobox')->name('airport')->caption('Airport:')->class('form-control data-source input-group form-select selectpicker init-on-update-delete')->controlsource('airport')->controltype('combobox')->enabled('false')->options(Airport::toCombobox())->out()];
 }