Ejemplo n.º 1
0
 public function index_onDelete()
 {
     if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) {
         foreach ($checkedIds as $mahasiswaid) {
             if (!($mhs = Pendaftaran::find($mahasiswaid))) {
                 continue;
             }
             $mhs->delete();
         }
         Flash::success('Successfully deleted those Mahasiswa.');
     }
     return $this->listRefresh();
 }
 public function onExport($exportId = null)
 {
     $exporter = Exporter::find($exportId);
     $result = Excel::create($exporter->title, function ($excel) use($exporter) {
         $excel->sheet($exporter->title, function ($sheet) use($exporter) {
             $sheet->setOrientation('landscape');
             $columns = $exporter->columns;
             $data = [$columns];
             $class = $exporter->model;
             $instance = new $class();
             // get the data for the columns above
             $rows = $instance->newQuery()->get($columns)->toArray();
             foreach ($rows as $row) {
                 array_push($data, $row);
             }
             $sheet->fromArray($data, null, 'A1', true);
         });
     })->store('xls');
     Flash::success('Downloaded excel file');
     $url = ['downloadurl' => url('/storage/exports/' . $result->filename . "." . $result->ext)];
     return $url;
 }
Ejemplo n.º 3
0
 /**
  * Ajax handler for removing members
  */
 public function onRemoveMember()
 {
     // refresh current step
     $this->currentStep = self::STEP_MEMBERS;
     if (($memberId = post('memberId')) != '' && ($groupId = post('groupId')) != '') {
         $user = User::find($memberId);
         if ($user) {
             if ($group = $this->getGroup($groupId)) {
                 // remove from group
                 $group->removeUser($user);
                 // Refresh current groupid
                 $this->currentGroupId = $groupId;
                 // Updated list of users and other vars
                 $this->prepareVars();
                 $message = Lang::get('dma.friends::lang.groups.memberRemoved');
                 Flash::info($message);
             }
         } else {
             $message = Lang::get('dma.friends::lang.exceptions.userNotFound');
             Flash::info($message);
         }
     }
 }
Ejemplo n.º 4
0
 /**
  * Ajax удаление элементов
  * @return mixed
  */
 public function index_onDelete()
 {
     $arElementsID = $this->obRequest->input('checked');
     if (empty($arElementsID) || !is_array($arElementsID)) {
         return $this->listRefresh();
     }
     foreach ($arElementsID as $iElementID) {
         if (!($obElement = Mailing::find($iElementID))) {
             continue;
         }
         $obElement->delete();
     }
     Flash::success(Lang::get('lovata.subscriptions::lang.message.delete_success'));
     return $this->listRefresh();
 }