예제 #1
0
 function generateReport()
 {
     $code = $this->generatePass();
     $now = Carbon::Now();
     $clients = isset($_GET["clients"]) ? $_GET["clients"] : null;
     $name = isset($_GET["name"]) ? $_GET["name"] : "";
     $periodFrom = isset($_GET["periodFrom"]) ? $_GET["periodFrom"] : null;
     $periodTo = isset($_GET["periodTo"]) ? $_GET["periodTo"] : null;
     if (is_null($clients)) {
         echo "Nepavyko nuskaityti parametro!";
         return;
     }
     $reports = new Reports();
     $reports->setName($name);
     $reports->setCode($code);
     $reports->setClients($clients);
     $reports->setOwner(9);
     $reports->setPeriod_from($periodFrom);
     $reports->setPeriod_to($periodTo);
     $reports->setAdd_date($now->toDateTimeString());
     $rez = $this->reportsDao->insert($reports);
     if (is_string($rez)) {
         echo "-1";
         return;
     }
     $fullUrl = $this->reportsUrl . $code;
     //$return = '<span style="font-size: 12px; font-weight: bold;">Ataskaitos adresas</span><br /><div class="well well-sm">'.$fullUrl.'</div>';
     $return = '<span style="font-size: 12px; font-weight: bold;">Ataskaitos adresas</span><br /><input type="text" class="form-control" id="exampleInputEmail1" value="' . $fullUrl . '" onclick="this.select(); document.execCommand(\'copy\');">';
     echo $return;
 }
예제 #2
0
 function find($criteria = null, $order = null, $limit = 1000, $from = 0)
 {
     $result = $this->database->query($this->buildFindQuery($criteria, $order, $limit, $from));
     if (!is_null($result->getError())) {
         return $result->getError();
     }
     $reportss = array();
     while ($row = $result->fetchRow()) {
         $reports = new Reports();
         $value = $row[0];
         $reports->setId($value);
         $value = $row[1];
         $reports->setName($value);
         $value = $row[2];
         $reports->setCode($value);
         $value = $row[3];
         $reports->setClients($value);
         $value = $row[4];
         $reports->setOwner($value);
         $value = $row[5];
         $reports->setPeriod_from($value);
         $value = $row[6];
         $reports->setPeriod_to($value);
         $value = $row[7];
         $reports->setAdd_date($value);
         if ($order != null) {
             array_push($reportss, $reports);
         } else {
             $reportss[$reports->getId()] = $reports;
         }
     }
     return $reportss;
 }