예제 #1
0
 public function actionOut()
 {
     $this->getUser()->logout();
     $this->flashMessage('Byl jste odhlášen.');
     $this->log->l('user.logout');
     $this->redirect('in');
 }
예제 #2
0
 public function handle(EventInterface $event)
 {
     $logger = Application::instance()->get('Logger');
     $log = new Log();
     $log->log = $logger->getLogString();
     $log->created_at = date('Y-m-d H:i:s');
     $log->save();
 }
예제 #3
0
 public function emailFormSucceeded(Form $form, $values)
 {
     $spravci = $this->role->findBy(array('role' => array(2, 3)));
     $spravciEmaily = array();
     foreach ($spravci as $spravce) {
         $spravciEmaily[] = $spravce->uzivatel->email;
     }
     $this->mailer->sendKontaktMail($values->email, $values->name, $values->message, array_unique($spravciEmaily));
     $this->flashMessage('Zpráva byla úspěšeně odeslána.');
     $this->log->l('kontakt.send');
     $this->redirect('Kontakt:');
 }
예제 #4
0
 public function getSendMsgUrl($phone, $content)
 {
     $url['username'] = getenv('SEND_MSG_SNAME');
     if (empty($url['username'])) {
         return false;
     }
     $url['password'] = getenv('SEND_MSG_SPWD');
     if (empty($url['password'])) {
         return false;
     }
     //        $url['scorpid'] = getenv('SEND_MSG_SCORPID');
     //        $url['sprdid'] = getenv('SEND_MSG_SPRDID');
     //        if (empty($url['sprdid'])) {
     //            return false;
     //        }
     $url['mobile'] = $phone;
     $url['smscontent'] = $content;
     $curl = getenv('SEND_MSG_URL') . '?' . http_build_query($url);
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $curl);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_HEADER, 0);
     $output = curl_exec($ch);
     curl_close($ch);
     \Log::info($output);
     return true;
 }
예제 #5
0
 public static function getReviewAbleUser($userId)
 {
     \Log::info("in get notification function");
     $collection = DB::Table('borrowHistory')->select('borrowHistory.ownedBookListId', 'borrowHistory.borrowerId', 'borrowHistory.borrowDate', 'borrowHistory.returnDate', 'ownedBookList.userId', 'bookinfo.bookid', 'bookinfo.bookName', 'user.userFullName', 'reputation.RecipientId', 'reputation.point')->join('ownedBooklist', 'ownedBooklist.ownedBooklistId', '=', 'borrowHistory.ownedBooklistId')->join('user', 'user.id', '=', 'borrowHistory.borrowerId')->join('bookinfo', 'ownedBooklist.bookid', '=', 'bookinfo.bookid')->join('reputation', 'reputation.RecipientId', '=', 'borrowHistory.borrowerId')->where('ownedBooklist.userId', $userId);
     //   $collection = $collection->orderby('');
     $notifications = $collection->get();
     $query = DB::Table('borrowHistory')->select('borrowHistory.borrowerId')->join('ownedBooklist', 'ownedBooklist.ownedBooklistId', '=', 'borrowHistory.ownedBooklistId')->where('ownedBooklist.userId', $userId);
     $data = $query->distinct()->get();
     \Log::info($data);
     \Log::info(".........borrwoer ids");
     $query = "";
     $query = DB::Table('user')->select('user.userFullName', 'user.id');
     for ($i = 0; $i < count($data); $i++) {
         if ($i == 0) {
             $query->where('user.Id', $data[$i]->borrowerId);
         } else {
             $query->orwhere('user.Id', $data[$i]->borrowerId);
         }
     }
     $data = $query->get();
     \Log::info($data);
     \Log::info(".......in get notification function returning");
     return $data;
     //  $notifications = "alamin";
     //   return $notifications;
 }
예제 #6
0
 public function actionDelete($id)
 {
     $this->testAndRedirectSpravce();
     $d = $this->dokument->find($id);
     if (!$d) {
         $this->error("Dokument s daným ID neexistuje.");
     }
     $d->delete();
     $this->flashMessage('Dokument byl úspěšně smazán.', 'success');
     $this->log->l('dokument.delete', $id);
     $this->redirect('Dokumenty:default');
 }
예제 #7
0
 public function nastenkaFormSucceeded(Form $form, $values)
 {
     if ($values->platnostTrvale || $values->platneDo === "") {
         $values->platneDo = -1;
     } else {
         $values->platneDo = $values->platneDo->format('U');
     }
     unset($values->platnostTrvale);
     $values->platneOd = $values->platneOd->format('U');
     $values->uzivatel_id = $this->user->id;
     if (empty($values->id)) {
         $id = $this->nastenka->insert($values);
         $this->log->l('nastenka.create', $id);
     } else {
         $id = $values->id;
         $this->nastenka->update($id, $values);
         $this->log->l('nastenka.edit', $id);
     }
     $this->flashMessage('Příspěvek na nástěnku byl úspěšeně uložen.', 'success');
     $this->redirect('Nastenka:');
 }
예제 #8
0
 public static function updateReputaionTable($obli, $bi, $point)
 {
     $collection = DB::Table('reputation')->select('*')->where('userId', $obli)->where('recipientId', $bi);
     $notifications = $collection->get();
     if (count($notifications) == 0) {
         DB::insert("INSERT INTO `reputation` (`UserID`, `RecipientId`, `Point`)\n              VALUES (?, ?, ?)", [$obli, $bi, $point]);
     } else {
         DB::table('reputation')->where('userId', $obli)->where('recipientId', $bi)->update(['point' => $point]);
     }
     \Log::info($notifications);
     \Log::info("........trying to update b.....reputation");
 }
예제 #9
0
파일: Book.php 프로젝트: shafi-/vlibrary
 public static function getAuthorId($AuthorName)
 {
     $BookId = DB::select(' select AuthorId ' . ' from authors  ' . ' where  AuthorName = ?; ', [$AuthorName]);
     //	 \Log::info ($BookId);
     //	 $temp = 5;
     // foreach ($BookId as $user) {
     //               //    echo  '<li class="list-group-item">' .$user->empname . " ...............  "
     //              //    ."</li>";
     //                   $temp = $user->BookId;
     //                   break;
     //    }
     $temp = $BookId[0]->AuthorId;
     \Log::info($temp);
     return $temp;
     \Log::info("in the function authorName");
 }
예제 #10
0
 public static function getOwnedBooklistIdByLocation($Location)
 {
     //  \Log::info("........in searchbook model ");
     \Log::info($Location);
     \Log::info(".....above is locationName");
     $query = DB::Table('Locations')->select('ownedBooklocations.ownedBookListId')->join('ownedBooklocations', 'locations.locationid', '=', 'ownedBooklocations.locationid');
     for ($i = 0; $i < count($Location); $i++) {
         if ($i == 0) {
             $query->where('Locations.locationName', 'like', '%' . $Location[$i] . '%');
         } else {
             $query->orwhere('Locations.locationName', 'like', '%' . $Location[$i] . '%');
         }
     }
     $data = $query->get();
     return $data;
 }
예제 #11
0
 public static function addToBookInfoCategory($bookId, $CategoryName)
 {
     $query = DB::table('category')->select('categoryId');
     for ($i = 0; $i < count($CategoryName); $i++) {
         if ($i == 0) {
             $query->where('CategoryName', $CategoryName[$i]);
         } else {
             $query->orwhere('CategoryName', $CategoryName[$i]);
         }
     }
     $categoryId = $query->get();
     \Log::info($categoryId);
     \Log::info("......categoryIds.");
     for ($i = 0; $i < count($categoryId); $i++) {
         DB::insert("INSERT INTO `bookinfocategory` (`BookId`, `CategoryId`)\n           VALUES (?, ?);", [$bookId, $categoryId[$i]->categoryId]);
     }
 }
예제 #12
0
 public function prispevekFormSucceeded(Form $form, $values)
 {
     $parentId = $values->parent ? $values->parent : $values->id;
     if (empty($values->id)) {
         $values->cas = time();
         $values->uzivatel_id = $this->user->id;
         $id = $this->diskuze->insert($values);
         $this->log->l('diskuze.createpost', $id);
         $this->flashMessage('Diskuzní příspěvek byl úspěšně přidán.', 'success');
     } else {
         $id = $values->id;
         $values->editcas = time();
         unset($values->parent);
         $this->diskuze->update($id, $values);
         $this->log->l('nastenka.editpost', $id);
         $this->flashMessage('Diskuzní příspěvek byl úspěšně upraven.', 'success');
     }
     $this->redirect('Diskuze:vlakno', $parentId);
 }
예제 #13
0
 public function osobaCreateFormSucceeded(Form $form, $values)
 {
     if (!$this->user->loggedIn) {
         $this->error('Pro tuto akci musí být uživatel přihlášen.');
     }
     if (!$this->user->isInRole('spravce')) {
         $this->error('Omlouváme se, ale tato funkce je pouze pro správce.');
     }
     $osoby = $this->parseOsoby($values->osoby);
     foreach ($osoby as &$osoba) {
         $heslo = Model\UserManager::genPassword(10);
         $osoba['heslo'] = sha1($heslo);
         $osoba['chceMaily'] = 1;
         $this->mailer->sendRegistrace($osoba['jmeno'], $heslo, $osoba['email']);
         $id = $this->uzivatel->insert($osoba);
         $this->role->insert(array('role' => 1, 'uzivatel_id' => $id));
     }
     $this->flashMessage('Uživatelé byli úspěšně zaregistrováni. Heslo jim bylo zasláno na uvedený email.', 'success');
     $this->log->l('uzivatel.masscreate', count($osoby));
     $this->redirect('Osoby:default');
 }
예제 #14
0
 /**
  * Exclude object from result
  *
  * @param   ChildLog $log Object to remove from the list of results
  *
  * @return $this|ChildLogQuery The current query, for fluid interface
  */
 public function prune($log = null)
 {
     if ($log) {
         $this->addUsingAlias(LogTableMap::COL_ID, $log->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
예제 #15
0
 public static function insertToBorrowHistoryTable($obli, $bi, $days)
 {
     \Log::info("trying to insernt in borrowhistory table form book model");
     BookInsertModel::insertToBorrowHistoryTable($obli, $bi, $days);
 }
예제 #16
0
 /**
  * add log message
  *
  * @param Log $log
  */
 public function addLog(Log $log)
 {
     $this->database->table(self::TABLE)->insert($log->toArray());
 }