Example #1
0
 function list_by_parent($id, $offset = 0, $limit = 20)
 {
     $catalogue = new Landcategory($id);
     $lands = new Land();
     $lands->where('landcategory_id', $id);
     $lands->order_by('name', 'asc');
     $lands->get_paged($offset, $limit, TRUE);
     setPagination($this->admin . 'estatetypes/list_by_parent/', $lands->paged->total_rows, $limit, 5);
     $dis['types'] = $lands;
     $dis['catalogue'] = $catalogue;
     $dis['base_url'] = base_url();
     $dis['view'] = 'land/list_by_parent';
     $dis['menu_active'] = 'Danh mục nhà đất';
     $dis['title'] = "Danh sách các loại thuộc <span style='color:#F00;'>" . $catalogue->name . '</span>';
     $dis['title_table'] = "Trang hiện tại:" . $lands->paged->current_page . '/' . $lands->paged->total_pages;
     $dis['nav_menu'] = array(array("type" => "back", "text" => "Quay về", "link" => "{$this->admin_url}estatecatalogues/list_all/", "onclick" => ""), array("type" => "add", "text" => "Thêm", "link" => "{$this->admin_url}lands/edit_by_parent/" . $catalogue->id, "onclick" => ""));
     $this->viewadmin($dis);
 }
 public function clickTracker()
 {
     $json_request = array('status' => FALSE, 'responseText' => '', 'redirect' => FALSE);
     if (Request::ajax()) {
         $validator = Validator::make(Input::all(), array('land_id' => 'required'));
         if ($validator->passes()) {
             if ($land = Land::where('id', Input::get('land_id'))->first()) {
                 $land->click = $land->click + 1;
                 $land->save();
                 $json_request['status'] = TRUE;
             }
         }
     } else {
         return Redirect::back();
     }
     return Response::json($json_request, 200);
 }
Example #3
0
 public function destroy($land_id)
 {
     $json_request = array('status' => FALSE, 'responseText' => '', 'redirect' => FALSE);
     if (Request::ajax()) {
         if ($gallery = Land::where('id', $land_id)->first()->gallery) {
             $photos = $gallery->photos;
             foreach ($gallery->photos as $photo) {
                 if (!empty($photo->name) && File::exists(Config::get('site.galleries_photo_dir') . '/' . $photo->name)) {
                     File::delete(Config::get('site.galleries_photo_dir') . '/' . $photo->name);
                 }
                 if (!empty($photo->name) && File::exists(Config::get('site.galleries_thumb_dir') . '/' . $photo->name)) {
                     File::delete(Config::get('site.galleries_thumb_dir') . '/' . $photo->name);
                 }
                 $photo->delete();
             }
             $gallery->delete();
         }
         if ($photo = Land::where('id', $land_id)->first()->photo) {
             if (!empty($photo->name) && File::exists(Config::get('site.galleries_photo_dir') . '/' . $photo->name)) {
                 File::delete(Config::get('site.galleries_photo_dir') . '/' . $photo->name);
             }
             if (!empty($photo->name) && File::exists(Config::get('site.galleries_thumb_dir') . '/' . $photo->name)) {
                 File::delete(Config::get('site.galleries_thumb_dir') . '/' . $photo->name);
             }
             $photo->delete();
         }
         Land::where('id', $land_id)->first()->recommended_lands()->detach();
         Land::where('id', $land_id)->delete();
         $json_request['responseText'] = "Участок удален.";
         $json_request['status'] = TRUE;
     } else {
         return Redirect::back();
     }
     return Response::json($json_request, 200);
 }
Example #4
0
                        <label class="input">
                            {{ ExtForm::gallery('gallery') }}
                        </label>
                    </section>
                    <section>
                        <label class="">
                            {{ Form::checkbox('sold', 1) }} Участок продан
                        </label>
                    </section>
                    <section>
                        <label class="label">Товарные рекомендации</label>

                        <div class="input select-multiple ">
                            <?php 
$lands = array();
foreach (Land::where('sold', 0)->orderByRaw('number + 0')->lists('number', 'id') as $id => $number) {
    $lands[$id] = "Участок №{$number}";
}
?>
                            {{ Form::select('recommended_lands[]', $lands, NULL, array('class'=>'select-multiple select2', 'multiple'=>'multiple')) }}
                        </div>
                    </section>
                </fieldset>
                <footer>
                    <a class="btn btn-default no-margin regular-10 uppercase pull-left btn-spinner"
                       href="{{URL::previous()}}">
                        <i class="fa fa-arrow-left hidden"></i> <span class="btn-response-text">Назад</span>
                    </a>
                    <button autocomplete="off" class="btn btn-success no-margin regular-10 uppercase btn-form-submit">
                        <i class="fa fa-spinner fa-spin hidden"></i> <span class="btn-response-text">Сохранить</span>
                    </button>
Example #5
0
    echo $row->name;
    ?>
</p>
                    </a>
                </div>
            <?php 
}
?>
        </div>
    </div>
    <div class="sreenbox3and4" style="float:left; width:160px; margin-top:15px; margin-left:30px;">
        <div class="box3">
            <?php 
$landcategories = new Landcategory(4);
$lands = new Land();
$lands->where('landcategory_id', $landcategories->id);
$lands->order_by('position', 'asc');
$lands->get(5);
?>
            <p align="left" style="color:#0c7102; font-size:15px; margin-bottom: 1px; font-weight:bold;">
                <a style="color:#0c7102;" href="<?php 
echo $landcategories->link;
?>
"><?php 
echo $landcategories->name;
?>
</a>
            </p>
            <?php 
foreach ($lands as $row) {
    ?>