public function filter_register(Profil $monprofil) { $options = array("options" => array("regexp" => "#[^0-9]#")); $options2 = array("options" => array("regexp" => "#[0-9]#")); if (filter_var($monprofil->getVille(), FILTER_VALIDATE_REGEXP, $options) && filter_var($monprofil->getPays(), FILTER_VALIDATE_REGEXP, $options) && filter_var($monprofil->getProfession(), FILTER_VALIDATE_REGEXP, $options) && filter_var($monprofil->getTelephone(), FILTER_VALIDATE_REGEXP, $options2)) { return true; } else { return false; } }
public function setNewRelationship($me, $user2) { $db = parent::connect(); $timestamp = time(); $user = new Profil(); $name = $user->getName(); $notice = "<a href='index.php?page=profil&profil={$me}'>Máte novou žádost o přátelstí od {$name}</a>"; $result = $db->prepare("INSERT INTO `relationship`(`user1`, `user2`, `timestamp`, `friends`) VALUES (?, ?, ?, ?)"); $result->execute(array($me, $user2, $timestamp, 0)); $result = $db->prepare("INSERT INTO `notice`(`title`, `timestamp`, `user`) VALUES (?, ?, ?)"); $result->execute(array($notice, $timestamp, $user2)); }
public function ambilDataPoinMember() { $periode = MemberPeriodePoin::model()->findByPk($this->periodeId); $command = Yii::app()->db->createCommand()->select('profil_id, p.nomor, p.nama, sum(poin) poin, p.alamat1, p.alamat2, p.alamat3, p.telp, p.hp, p.surel, p.identitas, p.tanggal_lahir')->from(PenjualanMember::model()->tableName() . ' t')->join(Profil::model()->tableName() . ' p', 't.profil_id = p.id')->where('year(t.updated_at)=:tahun and month(t.updated_at) between :awal and :akhir')->group('profil_id'); if ($this->sortBy == self::SORT_BY_POIN_ASC) { $command->order('sum(poin), p.nama'); } elseif ($this->sortBy == self::SORT_BY_POIN_DSC) { $command->order('sum(poin) desc, p.nama'); } $command->bindValues([':tahun' => $this->tahun, ':awal' => $periode->awal, ':akhir' => $periode->akhir]); return $command->queryAll(); }
public function LoadPro($id) { $prof = new Profil(); $allprofs = file('profile.txt'); foreach ($allprofs as $oneprof) { $onearr = explode($oneprof); if ($id == $onearr['0']) { $prof->setId($onearr['0']); $prof->setName($onearr['1']); $prof->setFirstname($onearr['2']); $prof->setAddress($onearr['3']); $prof->setPostalcode($onearr['4']); $prof->setTown($onearr['5']); return $prof; } } return false; }
<?php /** * Created by PhpStorm. * User: ununik * Date: 31.08.2015 * Time: 13:58 */ session_start(); function __autoload($name) { include_once "../../../models/Classes/{$name}.class.php"; } $profil = new Profil(0, $_SESSION['tiary']['login'], $_SESSION['tiary']['password']); $notices = new Notice(); $notices = $notices->seenNotice($_GET['id'], $profil->getId()); echo 'red0';
public function doResults($competition) { $race = $this->getCompetition($competition, 1000000000); $db = parent::connect(); $result = $db->prepare("SELECT * FROM `competition_registration` WHERE `competition`=?"); $result->execute(array($competition)); $startList = $result->fetchAll(); for ($i = 0; $i < count($startList); $i++) { $resultsUser[$i]['id'] = $startList[$i]['id']; $resultsUser[$i]['user'] = $startList[$i]['user']; $profil = new Profil($startList[$i]['user']); /** * If enegy for competition is higher then user energy -> user energy will be used */ if ($race['energy'] < $profil->getActulaEnergy()) { $resultsUser[$i]['energy'] = $race['energy']; } else { $resultsUser[$i]['energy'] = $profil->getActulaEnergy(); } $results[$i]['rand'] = rand(1000, 1500); $results[$i]['exeperience'] = $profil->getCompetitionExperience(); //activity points $resultsUser[$i]['timePoints'] = 0; $resultsUser[$i]['timePoints'] += $race['muscles'] * $profil->getMuscles(); $resultsUser[$i]['timePoints'] += $race['endurance'] * $profil->getEndurance(); $resultsUser[$i]['timePoints'] += $race['stability'] * $profil->getStability(); $resultsUser[$i]['timePoints'] += $race['psyche'] * $profil->getPsyche(); $resultsUser[$i]['timePoints'] += $race['morale'] * $profil->getMorale(); $resultsUser[$i]['timePoints'] += round($resultsUser[$i]['timePoints'] * $results[$i]['rand'] / 1000); //prone points $resultsUser[$i]['pronePoints'] = 0; $resultsUser[$i]['pronePoints'] += $race['accuracy'] * $profil->getAccuracy(); $resultsUser[$i]['pronePoints'] += $race['psyche'] * $profil->getPsyche(); $resultsUser[$i]['pronePoints'] += $race['morale'] * $profil->getMorale(); $resultsUser[$i]['pronePoints'] += round($resultsUser[$i]['pronePoints'] * $results[$i]['rand'] / 1000); $resultsUser[$i]['pronePoints'] += round($resultsUser[$i]['pronePoints'] * ($results[$i]['exeperience'] + 1000) / 1000); //standing points $resultsUser[$i]['standingPoints'] = 0; $resultsUser[$i]['standingPoints'] += $race['muscles'] * $profil->getMuscles(); $resultsUser[$i]['standingPoints'] += $race['accuracy'] * $profil->getAccuracy(); $resultsUser[$i]['standingPoints'] += $race['stability'] * $profil->getStability(); $resultsUser[$i]['standingPoints'] += $race['psyche'] * $profil->getPsyche(); $resultsUser[$i]['standingPoints'] += $race['morale'] * $profil->getMorale(); $resultsUser[$i]['standingPoints'] += round($resultsUser[$i]['standingPoints'] * $results[$i]['rand'] / 1000); $resultsUser[$i]['standingPoints'] += round($resultsUser[$i]['standingPoints'] * ($results[$i]['exeperience'] + 1000) / 1000); $resultsUser[$i]['timePoints'] = $resultsUser[$i]['timePoints'] + $resultsUser[$i]['pronePoints'] + $resultsUser[$i]['standingPoints']; $resultsUser[$i]['timePoints'] += round($resultsUser[$i]['timePoints'] * ($results[$i]['exeperience'] + 1000) / 1000); if ($resultsUser[$i]['energy'] != 0) { $resultsUser[$i]['timePoints'] = $resultsUser[$i]['timePoints'] * $resultsUser[$i]['energy']; } else { $resultsUser[$i]['timePoints'] = $resultsUser[$i]['timePoints'] * 0.5; } $timestamp = time(); $result = $db->prepare("UPDATE `competition_registration` SET `prone_points`=?, `standing_points`=?, `time_points`=?, `rand`=? WHERE `id`=?"); $result->execute(array($resultsUser[$i]['pronePoints'], $resultsUser[$i]['standingPoints'], $resultsUser[$i]['timePoints'], $results[$i]['rand'], $resultsUser[$i]['id'])); $energy = $profil->getActulaEnergy() - $resultsUser[$i]['energy']; $result = $db->prepare("UPDATE `user` SET `competition_experience`=?, `energy`=?, `lastEnergyTimestamp`=? WHERE `id`=?"); $result->execute(array($results[$i]['exeperience'] + 1, $energy, $timestamp, $resultsUser[$i]['user'])); $result = $db->prepare("INSERT INTO `activity`(`user`, `competition`, `timestamp`, `idActivity`) VALUES (?, ?, ?, ?)"); $result->execute(array($resultsUser[$i]['user'], 1, $timestamp, $competition)); } //RESULTS $result = $db->prepare("SELECT id FROM `competition_registration` WHERE `competition`=? ORDER BY `time_points`"); $result->execute(array($competition)); $startList = $result->fetchAll(); for ($i = 0; $i < count($startList); $i++) { $result = $db->prepare("UPDATE `competition_registration` SET `result`=? WHERE `competition`=? &&`user`=?"); $result->execute(array($i + 1, $competition, $resultsUser[$i]['user'])); } //PRONE $result = $db->prepare("SELECT `id`, `prone_points` FROM `competition_registration` WHERE `competition`=? ORDER BY `prone_points`"); $result->execute(array($competition)); $startList = $result->fetchAll(); for ($i = 0; $i < count($startList); $i++) { $procent = round(100 * $startList[$i]['prone_points'] / $startList[0]['prone_points']); if ($procent > 88) { $shooting = 0; } else { if ($procent > 75) { $shooting = 1; } else { if ($procent > 60) { $shooting = 2; } else { if ($procent > 48) { $shooting = 3; } else { if ($procent > 35) { $shooting = 4; } else { $shooting = 5; } } } } } $result = $db->prepare("UPDATE `competition_registration` SET `prone`=? WHERE `id`=?"); $result->execute(array($shooting, $startList[$i]['id'])); } //STANDING $result = $db->prepare("SELECT `id`, `standing_points` FROM `competition_registration` WHERE `competition`=? ORDER BY `standing_points`"); $result->execute(array($competition)); $startList = $result->fetchAll(); for ($i = 0; $i < count($startList); $i++) { $procent = round(100 * $startList[$i]['standing_points'] / $startList[0]['standing_points']); if ($procent > 92) { $shooting = 0; } else { if ($procent > 85) { $shooting = 1; } else { if ($procent > 77) { $shooting = 2; } else { if ($procent > 68) { $shooting = 3; } else { if ($procent > 50) { $shooting = 4; } else { $shooting = 5; } } } } } $result = $db->prepare("UPDATE `competition_registration` SET `standing`=? WHERE `id`=?"); $result->execute(array($shooting, $startList[$i]['id'])); } }
<?php /** * Created by PhpStorm. * User: ununik * Date: 16.09.2015 * Time: 10:51 */ session_start(); function __autoload($name) { include_once "../../../models/Classes/{$name}.class.php"; } $profil = new Profil(0, $_SESSION['tiary']['login'], $_SESSION['tiary']['password']); $diary = new IntimCalendar(); $date = date("j. n. Y"); if (isset($_GET['timestamp']) && $_GET['timestamp'] != 0) { $date = date("j. n. Y", $_GET['timestamp']); } $temperature = "36.0"; $err = array(); $blood = 0; $menstruace = 0; $timestampEntry = 0; $temperatureSelect = $diary->getLastTemperatur($profil->getId()); $temperatureINPUT = 0; $saved = 0; $factors = ""; $phlegm = ""; $suppository = ""; $comment = "";
<?php function __autoload($name) { include_once "../../../modules/classes/{$name}.class.php"; } session_start(); $profil = new Profil(); $profil->changeZajem($_POST['text'], $_POST['id']); return;
public function getNamaProfil() { $profil = Profil::model()->findByPk($this->profilId); return $profil->nama; }
public function delete() { $this->verifyLoaded(); $this->query('DELETE FROM ' . Profildesc::TABLE . ' WHERE profil=' . $this->id); parent::delete(); redirige("droits.php"); }
<?php function __autoload($name) { include_once "../../../modules/classes/{$name}.class.php"; } session_start(); $profil = new Profil(); if (!isset($_SESSION['kvh_login'])) { return; } $value = $_POST['value']; if ($_POST['value'] == 'true') { $value = 1; } if ($_POST['value'] == 'false') { $value = 0; } $profil->setField($_POST['field'], $value, $_SESSION['kvh_login']); echo 'ok';
<?php include '../../../models/config.php'; include '../../../models/helpers.php'; function __autoload($name) { include_once "../../../models/classes/{$name}.class.php"; } session_start(); $err = array(); $profil = new Profil($_SESSION['profil_id']); $competitions = new Competition(); if ($competitions->userIsRegistratedOnCompetition($profil->getId(), $_POST['id']) == false) { if (isset($_POST['registrate']) && $_POST['registrate'] == 'true') { $competitions->registrateUserForCompetition($profil->getId(), $_POST['id']); } } $competition = $competitions->getCompetition($_POST['id'], $profil->getLevel()); $container = "<h3>{$competition['title']}</h3>"; $container .= "<p>{$competition['description']}</p>"; $container .= "<div>startovné: {$competition['start_price']} EUR</div>"; $date = date('j. n. Y - H:i:s', $competition['date']); $container .= "<div>start: {$date}</div>"; if ($competitions->userIsRegistratedOnCompetition($profil->getId(), $_POST['id']) == true) { $container .= "<div id='registrationToCompetition' onclick='showStartlist(\"{$_POST['id']}\")'>Startovní listina</div>"; $container .= "<div id='startList'></div>"; } else { $container .= "<div id='registrationToCompetition' onclick='registrateOnCompetition(\"{$_POST['id']}\")'>Přihlásit se na závod</div>"; } print $container;
/** * * verify if the profile exists * * @param int $profil * @return type */ protected function verifyProfil($profil) { $pfil = new Profil(); return $pfil->charger_id($profil); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Profil the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Profil::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?php /** * Created by PhpStorm. * User: ununik * Date: 25.08.2015 * Time: 14:40 */ $entryDB = new Entry(); $entry = $entryDB->showEntry($_GET['id']); $date = date('j. n. Y', $entry['timestamp']); $author = new Profil($entry['author']); if ($author->getId() == $profil->getId()) { $update = "<a href='index.php?page=entries&entry={$entry['id']}'>upravit</a>"; } else { $update = ""; } $title = $entry['title'] . ' | Tiary'; $like = (include_once "controllers/log/entry/entry-like.php"); $comment = (include_once "controllers/log/entry/entry-comment.php"); return include_once "views/entry/entry-html.php";
<?php /** * Created by PhpStorm. * User: ununik * Date: 31.08.2015 * Time: 12:19 */ session_start(); function __autoload($name) { include_once "../../../models/Classes/{$name}.class.php"; } $profil = new Profil(0, $_SESSION['tiary']['login'], $_SESSION['tiary']['password']); $notices = new Notice(); $notices = $notices->getNotice($profil->getId()); print (include_once "../../../views/notice-ajax.php");
<?php function __autoload($name) { include_once "../../../modules/classes/{$name}.class.php"; } session_start(); $profil = new Profil(); $galleryClass = new Fotogalerie(); if (!isset($_SESSION['kvh_login']) || $_SESSION['kvh_login'] == "" || $_SESSION['kvh_login'] == 0 || !$profil->checkIDLogin($_SESSION['kvh_login'])) { return; } if (!isset($_GET['id'])) { return; } $gallery = $_GET['id']; $dir = "../../../fileadmin/foto/{$gallery}"; $fileDir = "fileadmin/foto/{$gallery}"; if (!file_exists($dir)) { mkdir($dir, 0777, true); } $newName = count(scandir($dir)) - 2; $errors = 0; if (isset($_FILES)) { if ($_FILES['image']['error'] == "") { $profile_image = $_FILES['image']; switch ($profile_image['type']) { case "image/png": $sufix = ".png"; break; case "image/gif":
<?php if (!isset($_GET['id']) || $_GET['id'] == "") { return include 'controllers/admin/clenove.php'; } $profilClen = new Profil(); $entries = new Entry(); $fotogalerie = new Fotogalerie(); $allEntriesForMember = $entries->getAllEntryForAuthor($_GET['id']); $member = $profilClen->getMember($_GET['id']); $jmeno = $profilClen->getNameFromId($member['id']); $page->addToDrobeckovaNavigace('<a href="admin.php?page=clenove">Členové</a>'); $page->addToDrobeckovaNavigace('<a href="admin.php?page=clen&id=' . $member['id'] . '">' . $jmeno . '</a>'); $page->setTitle("{$jmeno} | KVH Ústí nad Labem"); $clanky = (include 'views/admin/clenove/clanky.php'); if ($profil->getId() == $member['id']) { $kontakt = (include 'views/admin/clenove/kontakt_upr.php'); $foto = (include 'views/admin/clenove/foto_upr.php'); $omne = (include 'views/admin/clenove/omne_upr.php'); $ja = (include 'views/admin/clenove/ja_upr.php'); } else { $ja = ''; $kontakt = (include 'views/admin/clenove/kontakt.php'); $foto = (include 'views/admin/clenove/foto.php'); $omne = (include 'views/admin/clenove/omne.php'); } return include 'views/admin/clenove/one.php';
/** * Created by PhpStorm. * User: Florent * Date: 18/02/2015 * Time: 15:11 */ require_once '../class/Utilisateur.php'; require_once '../class/Profil.php'; require_once '../manager/UtilisateurManager.php'; require_once '../manager/ProfilManager.php'; require_once '../bdd/pdo.php'; /** Vérification */ /** Premiere partie formulaire $monnouvelUtilisateur */ $monNouvelUtilisateur = new Utilisateur(); $monNouvelUtilisateur->setNomfamille($_POST['nomfamille'])->setPrenom($_POST['prenom'])->setEmail($_POST['email'])->setMotdepasse($_POST['motdepasse'])->setNbenfant($_POST['nbenfant'])->setPoints()->setActive(1); $monNouveauProfil = new Profil(); $monNouveauProfil->setVille($_POST['ville'])->setPays($_POST['pays'])->setProfession($_POST['profession'])->setTelephone($_POST['telephone']); $monManagerUtilisateur = new UtilisateurManager($bdd); $monManagerProfil = new ProfilManager($bdd); if ($monManagerUtilisateur->filter_register($monNouvelUtilisateur) == true && $monManagerProfil->filter_register($monNouveauProfil) == true) { if ($monManagerUtilisateur->verification_util($monNouvelUtilisateur) == true) { $monManagerUtilisateur->insertion($monNouvelUtilisateur); /** Insertion utilisateur et profil */ $monManagerProfil->insertion_profil($monNouveauProfil); header('Location:../connexion-deconnexion/index.php'); } else { header('Location:../enregistrement/enregistrement_error.php'); } } else { header('Location:../enregistrement/enregistrement_error.php'); }
<?php /** * Created by PhpStorm. * User: ununik * Date: 25.08.2015 * Time: 17:15 */ $commentsBOXES = ""; foreach ($allComments as $allComment) { $authorComments = new Profil($allComment['author']); $dateComments = date('j. n. Y', $allComment['timestamp']); $textComments = $allComment['text']; $commentsBOXES .= "<div><a href='index.php?page=profil&profil={$authorComments->getId()}'>{$authorComments->getName()}</a></div>"; $commentsBOXES .= "<div>{$dateComments}</div>"; $commentsBOXES .= "<div>{$textComments}</div>"; } return $commentsBOXES;
/** * Ambil total poin yang sudah didapat * @return int total Poin Periode Berjalan */ public function getTotalPoinPeriodeBerjalan() { $profil = Profil::model()->findByPk($this->profil_id); if ($profil->isMember()) { $periodePoin = MemberPeriodePoin::model()->find('awal<=month(now()) and month(now())<=akhir'); $poin = false; if (!is_null($periodePoin)) { $poin = Yii::app()->db->createCommand()->select('sum(poin) total')->from(PenjualanMember::model()->tableName() . ' tpm')->where('YEAR(updated_at) = YEAR(NOW()) AND MONTH(updated_at) BETWEEN :awal AND :akhir AND profil_id=:profilId')->bindValues(array(':awal' => $periodePoin->awal, ':akhir' => $periodePoin->akhir, ':profilId' => $profil->id))->queryRow(); } else { /* Berarti periode lintas tahun (awal > akhir ) */ $periodePoinL = MemberPeriodePoin::model()->find('awal <= month(now()) OR month(now()) <= akhir AND awal > akhir'); if (!is_null($periodePoinL)) { $queryPoin = Yii::app()->db->createCommand()->select('sum(poin) total')->from(PenjualanMember::model()->tableName() . ' tpm')->where('profil_id=:profilId'); $curMonth = date('n'); if ($curMonth >= $periodePoinL->akhir) { $queryPoin->andWhere('YEAR(updated_at) = YEAR(NOW()) AND MONTH(updated_at) BETWEEN :awal AND :akhir'); $queryPoin->bindValues([]); } $queryPoin->bindValues(array(':awal' => $periodePoinL->awal, ':akhir' => $periodePoinL->akhir, ':profilId' => $profil->id)); $poin = $queryPoin->queryRow(); } } return $poin ? $poin['total'] : 0; } else { return 0; } }
<?php include '../../../models/config.php'; include '../../../models/helpers.php'; function __autoload($name) { include_once "../../../models/classes/{$name}.class.php"; } session_start(); $err = array(); $profil = new Profil($_SESSION['profil_id']); $job = new Job(); $activeJob = $job->getJobById(safeText($_POST['id']), $profil->getLevel(), $profil->getJobExpierence()); if ($profil->getActulaEnergy() < $activeJob['energy']) { $err[] = 'Nedostatek energie!'; } if (count($err) < 1) { $energy = $profil->getActulaEnergy() - $activeJob['energy']; $money = $profil->getMoney() + $activeJob['money']; $newJobExperience = $profil->getJobExpierence() + $activeJob['addExpierence']; $job->doJob($energy, $activeJob['energy'], $activeJob['id'], $profil->getId(), $money, $newJobExperience); echo 1; return; } foreach ($err as $err) { echo "<div>{$err}</div>"; }
public function _listBukanSupplier($id) { return Profil::model()->listSupplierYangBukan($id); }
require '../model/ProfilSql.php'; $errors = ''; $updateOk = true; if (!empty($_SESSION['login'])) { $tabInfo = [$_SESSION['login'], $_SESSION['firstname'], $_SESSION['lastname'], $_SESSION['gender'], $_SESSION['birthdate'], $_SESSION['email'], $_SESSION['memberDate']]; if (!empty($_POST)) { $userPseudo = trim(htmlspecialchars($_POST['login'])); $userFirstname = trim(htmlspecialchars($_POST['firstname'])); $userLastname = trim(htmlspecialchars($_POST['lastname'])); $userGender = trim(htmlspecialchars($_POST['gender'])); $userBirthdate = trim(htmlspecialchars($_POST['birthdate'])); $userMail = trim(htmlspecialchars($_POST['email'])); $userPassword = trim(htmlspecialchars($_POST['pwd'])); $passwordConfirm = trim(htmlspecialchars($_POST['pwd2'])); $passwordActual = trim(htmlspecialchars($_POST['pwdActual'])); $updateProfil = new Profil(); if (!isset($userPseudo) || strlen($userPseudo) < 4) { $errors = 'Your pseudo should have at least 4 characters'; $updateOk = false; } if (!isset($userFirstname) || !$userFirstname) { $errors = 'The firstname field should be filled'; $updateOk = false; } if (!isset($userLastname) || !$userLastname) { $errors = 'The lastname field should be filled'; $updateOk = false; } if (!isset($userGender) || !$userGender) { $errors = 'Please select a gender'; $updateOk = false;
<?php /** * Created by PhpStorm. * User: ununik * Date: 27.08.2015 * Time: 14:33 */ $profil = new Profil(0, $_SESSION['tiary']['login'], $_SESSION['tiary']['password']); $notices = new Notice(); $notices = $notices->getNumNotice($profil->getId()); $headerNotice = ""; if ($notices > 0) { $headerNotice = "!"; if ($notices > 1) { $headerNotice .= '<span class="headerNoticeNum">' . $notices . "</span>"; } } $headerName = "<span class='headerName'>{$profil->getName()}</span>"; $html->addToHeader("<a href='index.php?page=profil'>"); $html->addToHeader($headerName); $html->addToHeader("<img src='images/profile_images/small/{$profil->getProfilImage()}' id='header_profile_image'>"); $html->addToHeader("</a>"); $html->addToHeader("<span class='headerNotice' onclick='getUnseenNotices()'>{$headerNotice}</span>");
public function actionPls() { $model = new ReportPlsForm(); $report = null; if (isset($_POST['ReportPlsForm'])) { $model->attributes = $_POST['ReportPlsForm']; if ($model->validate()) { $report = $model->reportPls(); } } $profil = new Profil('search'); $profil->unsetAttributes(); // clear any default values if (isset($_GET['Profil'])) { $profil->attributes = $_GET['Profil']; } $tipePrinterAvailable = [Device::TIPE_PDF_PRINTER]; $printers = Device::model()->listDevices($tipePrinterAvailable); $kertasUntukPdf = ReportPlsForm::listKertas(); $this->render('pls', ['model' => $model, 'profil' => $profil, 'report' => $report, 'printers' => $printers, 'kertasPdf' => $kertasUntukPdf]); }
public function actionPilihProfil($id) { $profil = Profil::model()->findByPk($id); $return = array('id' => $id, 'nama' => $profil->nama, 'alamat1' => $profil->alamat1); $this->renderJSON($return); }
<?php /** * Created by PhpStorm. * User: ununik * Date: 26.08.2015 * Time: 14:07 */ $container = "<h1>Kontakty</h1>"; $container .= "<div class='textInput_div'><form action='' method='get'><input type='text' value='contacts' name='page' hidden>\n <input type='text' name='search' value='{$search}'><input type='submit' value='hledat' class='submit'>\n </form></div>\n "; foreach ($users as $user) { $userprofil = new Profil($user['id']); $container .= "<div><a href='index.php?page=profil&profil={$user['id']}'>{$userprofil->getName()}</a></div>"; } return $container;
<?php include '../../../models/config.php'; include '../../../models/helpers.php'; function __autoload($name) { include_once "../../../models/classes/{$name}.class.php"; } session_start(); $err = array(); $profil = new Profil($_SESSION['profil_id']); $store = new Store(); $item = $store->getItemById($_POST['id'], $profil->getLevel()); if ($profil->getMoney() < $item['price']) { $err[] = 'Nedostatek peněz'; } if (count($err) < 1) { $money = $profil->getMoney() - $item['price']; $store->buyItem($item['id'], $profil->getId(), $money); echo 'Koupeno'; return; } foreach ($err as $err) { echo "<div>{$err}</div>"; }
public function exportPdf($id, $kertas = ReturPembelian::KERTAS_A4, $draft = false) { $modelHeader = $this->loadModel($id); $configs = Config::model()->findAll(); /* * Ubah config (object) jadi array */ $branchConfig = array(); foreach ($configs as $config) { $branchConfig[$config->nama] = $config->nilai; } /* * Data Supplier */ $profil = Profil::model()->findByPk($modelHeader->profil_id); /* * Retur Pembelian Detail */ $returPembelianDetail = ReturPembelianDetail::model()->with('inventoryBalance', 'inventoryBalance.barang')->findAll(array('condition' => "retur_pembelian_id={$id}", 'order' => 'barang.nama')); /* * Persiapan render PDF */ $listNamaKertas = ReturPembelian::listNamaKertas(); $mPDF1 = Yii::app()->ePdf->mpdf('', $listNamaKertas[$kertas]); $viewCetak = '_pdf'; if ($draft) { $viewCetak = '_pdf_draft'; } $mPDF1->WriteHTML($this->renderPartial($viewCetak, array('modelHeader' => $modelHeader, 'branchConfig' => $branchConfig, 'profil' => $profil, 'returPembelianDetail' => $returPembelianDetail), true)); $mPDF1->SetDisplayMode('fullpage'); $mPDF1->pagenumSuffix = ' dari '; $mPDF1->pagenumPrefix = 'Halaman '; // Render PDF $mPDF1->Output("{$modelHeader->nomor}.pdf", 'I'); }