Example #1
0
 public function InsertNewClient(Client $c = null)
 {
     if ($c == null || !$c instanceof Client) {
         return false;
     }
     $props = array("Name," => $c->getName(), "Alias," => $c->getAlias(), "ContactName," => $c->getContactName(), "Phone," => $c->getPhone(), "Country," => $c->getCountry(), "StateProv," => $c->getStateProv(), "City," => $c->getCity(), "ZipPostal," => $c->getZipPostal(), "DateAdded," => $c->getDateAdded(), "AddedByUserID," => $c->getAddedByUserID(), "OnSiteEmployee" => $c->getOnSiteEmployee());
     foreach ($props as $k => $v) {
         if ($v != null) {
             if ($k == "OnSiteEmployee") {
                 $_props[$k] = "{$v}";
             } else {
                 if (gettype($v) == "string") {
                     $_props[$k] = "'" . $v . "', ";
                 } else {
                     $_props[$k] = "{$v}, ";
                 }
             }
         }
     }
     $this->_dbAdapt->IStatement($this->dbTbl, $_props);
     $tmp = $this->_dbAdapt->getLnk();
     $tmp->query($this->_dbAdapt->getQry());
     unset($tmp);
     return true;
 }
Example #2
0
 public function encodeClient(Client $client)
 {
     $data = ['name' => $client->getName(), 'company' => $client->getCompany(), 'identifier' => $client->getIdentifier(), 'vat_number' => $client->getVatNumber(), 'tax_number' => $client->getTaxNumber()];
     if ($client->getAddress()) {
         $data['address'] = $this->encodeAddress($client->getAddress());
     }
     return $data;
 }
Example #3
0
 public function testGetDefaults()
 {
     $client = new Client();
     $this->assertNotEmpty($client->getName(), 'Unable to get default name!');
     $this->assertNotEmpty($client->getTitle(), 'Unable to get default title!');
     $this->assertNotNull($client->getViewOptions(), 'Unable to get default view options!');
     $this->assertNotNull($client->getNormalizeUserAttributeMap(), 'Unable to get default normalize user attribute map!');
 }
Example #4
0
 function testGetName()
 {
     $name = "Stuart";
     $phone = "555-555-5555";
     $stylist_id = 1;
     $test_client = new Client($name, $phone, $stylist_id);
     $result = $test_client->getName();
     $this->assertEquals($name, $result);
 }
Example #5
0
 function test_getName()
 {
     $name = "Jane Doe";
     $test_stylist = new Stylist($name);
     $test_stylist->save();
     $client_name = "Jimmy";
     $client_stylist_id = $test_stylist->getId();
     $test_client = new Client($client_name, $client_stylist_id);
     $result = $test_client->getName();
     $this->assertEquals($client_name, $result);
 }
Example #6
0
 function test_getName()
 {
     //Arrange
     $client_name = "Bill Withers";
     $client_phone = "5415134876";
     $stylist = new Stylist("Diane", "5035528959", "MPB", false);
     $stylist->save();
     $client = new Client($client_name, $client_phone, $stylist->getId());
     //Act
     $result = $client->getName();
     //Assert
     $this->assertEquals($client_name, $result);
 }
Example #7
0
 function test_getName()
 {
     //Arrange
     $name = "Sandra Jane";
     $phone = "542-334-0984";
     $style_choice = "The Rachel";
     $stylist_id = 1;
     $id = null;
     $test_client = new Client($name, $phone, $style_choice, $stylist_id, $id);
     //Act
     $result = $test_client->getName();
     //Assert
     $this->assertEquals($name, $result);
 }
Example #8
0
 function test_getName()
 {
     //Arrange
     $name = "ben";
     $phone = "542-123-1234";
     $style_choice = " shave 1";
     $stylist_id = 1;
     $id = null;
     $test_client = new Client($name, $phone, $style_choice, $stylist_id, $id);
     //Act
     $result = $test_client->getName();
     //Assert
     $this->assertEquals($name, $result);
 }
 /**
  *
  * @param Client $client
  * @return type
  * @throws DaoException 
  */
 public function updateClient(Client $client)
 {
     try {
         $query = Doctrine_Query::create()->update('Client i');
         $query->set('i.name', '?', $client->getName());
         $query->set('i.address', '?', $client->getAddress());
         $query->set('i.tp_hp', '?', $client->getTpHp());
         $query->set('i.tp_home', '?', $client->getTpHome());
         $query->set('i.notes', '?', $client->getNotes());
         $query->where('i.id = ?', $client->getId());
         return $query->execute();
     } catch (Exception $e) {
         throw new DaoException($e->getMessage(), $e->getCode(), $e);
     }
 }
Example #10
0
 function test_getName()
 {
     //Arrange
     $name = "Erin";
     $id = null;
     $test_stylist = new Stylist($name, $id);
     $test_stylist->save();
     $name = "George";
     $stylist_id = $test_stylist->getId();
     $test_client = new Client($name, $stylist_id, $id);
     $test_client->save();
     //Act
     $result = $test_client->getName();
     //Assert
     $this->assertEquals($name, $result);
 }
Example #11
0
 function test_getName()
 {
     //Arrange
     $name = "Sasha";
     $id = null;
     $test_stylist = new Stylist($name, $id);
     $test_stylist->save();
     $c_name = "Garry Gergich";
     $phone = "503-472-8959";
     $stylist_id = $test_stylist->getId();
     $test_client = new Client($c_name, $phone, $id, $stylist_id);
     //Act
     $result = $test_client->getName();
     //Assert
     $this->assertEquals($c_name, $result);
 }
Example #12
0
 function testUpdate()
 {
     //Arrange
     $name = "Bob";
     $id = null;
     $test_stylist = new Stylist($name, $id);
     $test_stylist->save();
     $client_name = "Gertrude";
     $stylist_id = $test_stylist->getId();
     $test_client = new Client($client_name, $stylist_id, $id);
     $test_client->save();
     $new_client_name = "Billy";
     //Act
     $test_client->update($new_client_name);
     //Assert
     $this->assertEquals("Billy", $test_client->getName());
 }
 public function checkTaxes(Client $client)
 {
     $haveDecl = false;
     foreach ($this->declarations as $k => $v) {
         if ($v->getClient() == $client) {
             echo 'Check for ' . $client->getName() . ' EGN: ' . $client->getEGN() . PHP_EOL;
             $haveDecl = true;
             foreach ($v->getAssetsList() as $key => $value) {
                 echo 'Asset: ' . $value->getName() . ' Price: ' . $value->getPrice() . ' Tax:' . $value->getTax() . PHP_EOL;
             }
             echo PHP_EOL;
         }
     }
     if (!$haveDecl) {
         throw new Exception('No Declaration of this person !!');
     } else {
         $s = new Service($this->employees[0], $client, 'Check');
         $this->services[] = $s;
         self::store($s, 'Checks', count($this->services));
     }
 }
Example #14
0
 public function addClient(Client $client)
 {
     return $this->storage->execute('INSERT INTO client(id,secret,name,redirect_url,user_id,description) VALUES ("' . $client->getId() . '" , "' . $client->getSecret() . '" ,"' . $client->getName() . '" ,"' . $client->getRedirectUrl() . '" ,"' . $client->getUserId() . '","' . $client->getDescription() . '")');
 }
Example #15
0
?>
			<input type="submit" value="Complete" onClick="setCompleted()">
			<?php 
//}
?>
			<hr>
			<table>
				<tr><td style="width:200px;">Order Code</td>
					<td style="width:200px;">Title</td>
					<td style="width:200px;">Client</td>
					<td style="width:200px;">Destination</td>
					<td style="width:200px;">Action</td>
				</tr>
				<?php 
for ($i = 0; $i < sizeof($orderList); $i++) {
    $mOrder = new Order($orderList[$i]);
    $mClient = new Client($mOrder->getClient());
    echo "<tr>";
    echo "<td><a href='../order/detail.php?id=" . $mOrder->getId() . "'>" . $mOrder->getCode() . "</a></td>";
    echo "<td>" . $mOrder->getTitle() . "</td>";
    echo "<td><a href='../client/detail.php?id=" . $mClient->getId() . "'>" . $mClient->getName() . "</a></td>";
    echo "<td>" . $mOrder->getDestination() . "</td>";
    echo "<td><input type='submit' value='Assign'><input type='submit' value='Track'></td>";
    echo "</tr>";
}
?>
			</table>
		<div>
	</div>
	
</body> 
Example #16
0
?>
	</div>
	<div id="container">
		<div id="sidebar" style="float:left;width:15%;">
		<?php 
include 'sidebar.php';
?>
		</div>
		<div id="content" style="float:right;width:85%;">
			Add Order
			<form action="action.php?action=add" method="POST">
			<table>
				<tr><td>Title</td><td><input type="text" name="title" id="title"></td></tr>
				<tr><td>Client</td>
					<td><select name="client" id="client"><option> --- Select Client --- </option>
					<?php 
for ($i = 0; $i < sizeof($mClientList); $i++) {
    $mClient = new Client($mClientList[$i]);
    echo "<option value=" . $mClientList[$i] . ">" . $mClient->getName() . "</option>";
}
?>
					</select></td></tr>
				<tr><td>Destination</td><td><textarea name="destination" id="destination" ></textarea></td></tr>
				<tr><td>Description</td><td><textarea name="description" id="description" ></textarea></td></tr>
				<tr><td><input type="submit" value="Add Order"></td></tr>
			</table>
			</form>
		<div>
	</div>
	
</body> 
Example #17
0
 function test_update()
 {
     //Arrange
     $name = "Becky";
     $id = null;
     $test_stylist = new Stylist($name, $id);
     $test_stylist->save();
     $client = "Mark";
     $phone = "123-456-7890";
     $stylist_id = $test_stylist->getId();
     $test_client = new Client($client, $phone, $stylist_id, $id);
     $test_client->save();
     $new_client_name = "Peter";
     //Act
     $test_client->update($new_client_name);
     //Assert
     $this->assertEquals("Peter", $test_client->getName());
 }
Example #18
0
		<div id="sidebar" style="float:left;width:15%;">
		<?php 
include 'sidebar.php';
?>
		</div>
		<div id="content" style="float:right;width:85%;">
			<table>
				<tr><td style="width:200px;">Order</td>
					<td style="width:200px;">Title</td>
					<td style="width:200px;">Client</td>
					<td style="width:200px;">Destination</td>
					<td style="width:200px;">Action</td>
				</tr>
				<?php 
for ($i = 0; $i < sizeof($mOrderList); $i++) {
    $mOrder = new Order($mOrderList[$i]);
    $mClient = new Client($mOrder->getClient());
    echo "<tr>";
    echo "<td>" . $mOrder->getCode() . "</td>";
    echo "<td>" . $mOrder->getTitle() . "</td>";
    echo "<td>" . $mClient->getName() . "</td>";
    echo "<td>" . $mOrder->getDestination() . "</td>";
    echo "<td><input type='submit' value='Assign'><input type='submit' value='Track'></td>";
    echo "</tr>";
}
?>
			</table>
		<div>
	</div>
	
</body> 
Example #19
0
 /**
  * @test
  * @testdox Try update client
  */
 public function update()
 {
     $name = 'UpdateName';
     $this->setModelAttributes();
     $id = $this->model->save();
     $this->model->setId($id);
     $this->model->setName($name);
     $this->model->update();
     $retrieved = new Client($this->pdo);
     $retrieved->retrieve($id);
     $this->assertEquals($this->model->getName(), $retrieved->getName(), 'Could not update');
 }
Example #20
0
 function test_update()
 {
     $name = "Sally";
     $phone = "555-555-5555";
     $id = null;
     $test_stylist = new Stylist($name, $phone, $id);
     $test_stylist->save();
     $name = "Maggie";
     $phone = "123-321-1234";
     $stylist_id = $test_stylist->getId();
     $test_client = new Client($name, $phone, $id, $stylist_id);
     $test_client->save();
     $new_name = "George";
     $new_phone = "123-456-7890";
     $test_client->update($new_name, $new_phone);
     $this->assertEquals("George", $test_client->getName());
     $this->assertEquals("123-456-7890", $test_client->getPhone());
 }
Example #21
0
 function actionSaveClient($currentProject)
 {
     $backUrl = $this->context->getFlowScopeAttr("backUrl");
     $projectID = $this->context->getRequestAttr("projectID");
     $edit = $this->context->getRequestAttr("edit");
     $client = new Client();
     $clientErrs = array();
     $client->setId($this->context->getRequestAttr("id"));
     $client->setPid($this->context->getRequestAttr("projectID"));
     $client->setName($this->context->getRequestAttr("name"));
     if (!is_null($client->getName())) {
         $client->setName(trim($client->getName()));
         if (strlen($client->getName()) < 1) {
             $client->setName(null);
         }
     }
     if (is_null($client->getName())) {
         $clientErrs["name"] = "field.error.empty";
     }
     $client->setEmail($this->context->getRequestAttr("email"));
     if (!is_null($client->getEmail())) {
         $client->setEmail(trim($client->getEmail()));
         if (strlen($client->getEmail()) < 1) {
             $client->setEmail(null);
         }
     }
     if (is_null($client->getEmail())) {
         $clientErrs["email"] = "field.error.empty";
     }
     $client->setTelephone($this->context->getRequestAttr("telephone"));
     if (!is_null($client->getTelephone())) {
         $client->setTelephone(trim($client->getTelephone()));
         if (strlen($client->getTelephone()) < 1) {
             $client->setTelephone(null);
         }
     }
     $client->setCustomer($this->context->getRequestAttr("customer"));
     if (!is_null($client->getCustomer())) {
         $client->setCustomer(trim($client->getCustomer()));
         if (strlen($client->getCustomer()) < 1) {
             $client->setCustomer(null);
         }
     }
     $client->setComment($this->context->getRequestAttr("comment"));
     if (!is_null($client->getComment())) {
         $client->setComment(trim($client->getComment()));
         if (strlen($client->getComment()) < 1) {
             $client->setComment(null);
         }
     }
     $client->setPeriodical(false);
     $client->setPeriodicalid(0);
     $timeZone = new DateTimeZone("Europe/Vilnius");
     $time = new DateTime("now", $timeZone);
     $client->setR_date($time->format("Y-m-d H:i:s"));
     $client->setR_user(777);
     $client->setActive(true);
     $this->context->setFlashScopeAttr("createClient", $client);
     $this->context->setFlashScopeAttr("clientErrs", $clientErrs);
     $this->context->setFlashScopeAttr("projectID", $projectID);
     if (count($clientErrs) >= 1) {
         if (!is_null($backUrl)) {
             header("Location: " . $backUrl);
             return true;
         }
         return false;
     }
     $insert = true;
     $store = $this->storeClient($client);
     if (!$store) {
         if (!is_null($backUrl)) {
             header("Location: " . $backUrl);
             return true;
         }
         return false;
     }
     if ($insert && $edit == 0) {
         $eventHistory = new EventHistory();
         $eventHistory->setPid($client->getPid());
         $eventHistory->setCid($client->getId());
         $eventHistory->setR_date($client->getR_date());
         $eventHistory->setDescription("Sukurtas partnerio");
         $this->storeEventHistory($eventHistory);
     }
     $this->cancelClientCreate();
     if (!is_null($backUrl)) {
         header("Location: " . $backUrl);
         return true;
     }
     return false;
 }
 function formatClientInfo(Client $client, $needBreak = false)
 {
     $sep = $needBreak ? "<br />" : " ";
     return htmlspecialchars($client->getName()) . $sep . htmlspecialchars($client->getEmail()) . $sep . htmlspecialchars($client->getTelephone());
 }
 /**
  * Runs a client level pre or post script.
  *
  * @param  string   $type       Either "pre" or "post".
  *
  * @param  int      $status     Status of previos command.
  *
  * @param  Client   $client     Client entity
  *
  * @param  Job      $job        Job entity. Null if running at the client level.
  *
  * @param  Script   $script     Script entity
  *
  * @param  string   $stats      Stats for script environment vars (not stored in DB)
  *
  * @return boolean  true on success, false on error.
  *
  */
 protected function runScript($type, $status, $client, $job, $script, $stats)
 {
     if ($script === null) {
         return true;
     }
     if (null == $job) {
         $entity = $client;
         $context = array('link' => $this->generateClientRoute($client->getId()));
         $errScriptError = 'Client "%entityid%" %scripttype% script "%scriptname%" execution failed. Diagnostic information follows: %output%';
         $errScriptMissing = 'Client "%entityid%" %scripttype% script "%scriptname%" present but file "%scriptfile%" missing.';
         $errScriptOk = 'Client "%entityid%" %scripttype% script "%scriptname%" execution succeeded. Output follows: %output%';
         $level = 'CLIENT';
         // Empty vars (only available under JOB level)
         $job_name = '';
         $owner_email = '';
         $recipient_list = '';
         $job_total_size = 0;
         $job_run_size = 0;
         $job_starttime = 0;
         $job_endtime = 0;
         if ($type == 'post') {
             $client_endtime = $stats['ELKARBACKUP_CLIENT_ENDTIME'];
             $client_starttime = $stats['ELKARBACKUP_CLIENT_STARTTIME'];
         } else {
             $client_endtime = 0;
             $client_starttime = 0;
         }
     } else {
         $entity = $job;
         $context = array('link' => $this->generateJobRoute($job->getId(), $client->getId()));
         $errScriptError = 'Job "%entityid%" %scripttype% script "%scriptname%" execution failed. Diagnostic information follows: %output%';
         $errScriptMissing = 'Job "%entityid%" %scripttype% script "%scriptname%" present but file "%scriptfile%" missing.';
         $errScriptOk = 'Job "%entityid%" %scripttype% script "%scriptname%" execution succeeded. Output follows: %output%';
         $level = 'JOB';
         $job_name = $job->getName();
         $owner_email = $job->getOwner()->getEmail();
         $recipient_list = $job->getNotificationsEmail();
         $job_total_size = $job->getDiskUsage();
         $client_starttime = 0;
         $client_endtime = 0;
         if ($type == 'post') {
             $job_run_size = $stats['ELKARBACKUP_JOB_RUN_SIZE'];
             $job_starttime = $stats['ELKARBACKUP_JOB_STARTTIME'];
             $job_endtime = $stats['ELKARBACKUP_JOB_ENDTIME'];
         } else {
             $job_run_size = 0;
             $job_starttime = 0;
             $job_endtime = 0;
         }
     }
     $scriptName = $script->getName();
     $scriptFile = $script->getScriptPath();
     if (!file_exists($scriptFile)) {
         $this->err($errScriptMissing, array('%entityid%' => $entity->getId(), '%scriptfile%' => $scriptFile, '%scriptname%' => $scriptName, '%scripttype%' => $type), $context);
         return false;
     }
     $commandOutput = array();
     $command = sprintf('env ELKARBACKUP_LEVEL="%s" ELKARBACKUP_EVENT="%s" ELKARBACKUP_URL="%s" ELKARBACKUP_ID="%s" ELKARBACKUP_PATH="%s" ELKARBACKUP_STATUS="%s" ELKARBACKUP_CLIENT_NAME="%s" ELKARBACKUP_JOB_NAME="%s" ELKARBACKUP_OWNER_EMAIL="%s" ELKARBACKUP_RECIPIENT_LIST="%s" ELKARBACKUP_CLIENT_TOTAL_SIZE="%s" ELKARBACKUP_JOB_TOTAL_SIZE="%s" ELKARBACKUP_JOB_RUN_SIZE="%s" ELKARBACKUP_CLIENT_STARTTIME="%s" ELKARBACKUP_CLIENT_ENDTIME="%s" ELKARBACKUP_JOB_STARTTIME="%s" ELKARBACKUP_JOB_ENDTIME="%s" sudo "%s" 2>&1', $level, 'pre' == $type ? 'PRE' : 'POST', $entity->getUrl(), $entity->getId(), $entity->getSnapshotRoot(), $status, $client->getName(), $job_name, $owner_email, $recipient_list, $client->getDiskUsage(), $job_total_size, $job_run_size, $client_starttime, $client_endtime, $job_starttime, $job_endtime, $scriptFile);
     exec($command, $commandOutput, $status);
     if (0 != $status) {
         $this->err($errScriptError, array('%entityid%' => $entity->getId(), '%output%' => "\n" . implode("\n", $commandOutput), '%scriptname%' => $scriptName, '%scripttype%' => $type), $context);
         return false;
     }
     $this->info($errScriptOk, array('%entityid%' => $entity->getId(), '%output%' => "\n" . implode("\n", $commandOutput), '%scriptname%' => $scriptName, '%scripttype%' => $type), $context);
     return true;
 }
Example #24
0
 function actionSaveClient($currentUser)
 {
     $backUrl = $this->context->getFlowScopeAttr("backUrl");
     $client = new Client();
     $clientErrs = array();
     $client->setId($this->context->getRequestAttr("id"));
     $client->setPid($this->context->getRequestAttr("projectID"));
     $client->setName($this->context->getRequestAttr("name"));
     if (!is_null($client->getName())) {
         $client->setName(trim($client->getName()));
         if (strlen($client->getName()) < 1) {
             $client->setName(null);
         }
     }
     if (is_null($client->getName())) {
         $clientErrs["name"] = "field.error.empty";
     }
     $client->setEmail($this->context->getRequestAttr("email"));
     if (!is_null($client->getEmail())) {
         $client->setEmail(trim($client->getEmail()));
         if (strlen($client->getEmail()) < 1) {
             $client->setEmail(null);
         }
     }
     if (is_null($client->getEmail())) {
         $clientErrs["email"] = "field.error.empty";
     }
     $client->setTelephone($this->context->getRequestAttr("telephone"));
     if (!is_null($client->getTelephone())) {
         $client->setTelephone(trim($client->getTelephone()));
         if (strlen($client->getTelephone()) < 1) {
             $client->setTelephone(null);
         }
     }
     $client->setCustomer($this->context->getRequestAttr("customer"));
     if (!is_null($client->getCustomer())) {
         $client->setCustomer(trim($client->getCustomer()));
         if (strlen($client->getCustomer()) < 1) {
             $client->setCustomer(null);
         }
     }
     $client->setComment($this->context->getRequestAttr("comment"));
     if (!is_null($client->getComment())) {
         $client->setComment(trim($client->getComment()));
         if (strlen($client->getComment()) < 1) {
             $client->setComment(null);
         }
     }
     $periodicalID = $this->context->getRequestAttr("periodicalid");
     $periodical = $this->context->getRequestAttr("periodCustomer");
     $client->setPeriodical($periodical == 1 ? true : false);
     $timeZone = new DateTimeZone("Europe/Vilnius");
     $time = new DateTime("now", $timeZone);
     $client->setR_date($time->format("Y-m-d H:i:s"));
     $client->setR_user($currentUser->getId());
     $client->setActive(true);
     if (!is_null($periodicalID) && !$client->isPeriodical()) {
         $this->clientPeriodicalDao->delete($periodicalID);
         $this->clientDaol->resetPeriodicalClients($periodicalID);
         $client->setPeriodicalid(0);
     }
     if ($client->isPeriodical()) {
         $clientPeriodical = new ClientPeriodical();
         $clientPeriodical->setId($periodicalID);
         $clientPeriodical->setPid($client->getPid());
         $clientPeriodical->setName($client->getName());
         $clientPeriodical->setEmail($client->getEmail());
         $clientPeriodical->setCustomer($client->getCustomer());
         $clientPeriodical->setTelephone($client->getTelephone());
         $clientPeriodical->setComment($client->getComment());
         $clientPeriodical->setR_date($time->format("Y-m-d H:i:s"));
         $clientPeriodical->setR_user($currentUser->getId());
         $clientPeriodical->setPeriod_type($this->context->getRequestAttr("period_type"));
         $clientPeriodical->setWeek_day($this->context->getRequestAttr("week_day"));
         $clientPeriodical->setMonth_day($this->context->getRequestAttr("month_day"));
         $clientPeriodical->setHour($this->context->getRequestAttr("hour"));
     } else {
         $clientPeriodical = new ClientPeriodical();
     }
     $this->context->setFlashScopeAttr("client", $client);
     $this->context->setFlashScopeAttr("clientPeriodical", $clientPeriodical);
     $this->context->setFlashScopeAttr("clientErrs", $clientErrs);
     $projectID = $client->getPid();
     if (!$this->setStoreProject($projectID, "clientProject")) {
         $this->cancelClientEdit();
         if (!is_null($backUrl)) {
             header("Location: " . $backUrl);
             return true;
         }
         return false;
     }
     if (count($clientErrs) >= 1) {
         if (!is_null($backUrl)) {
             header("Location: " . $backUrl);
             return true;
         }
         return false;
     }
     $insert = false;
     if (is_null($client->getId())) {
         $insert = true;
     }
     $periodicalStore = false;
     $clientStore = false;
     // Jei klientas periodinis - sukuriam periodini klienta atskirai
     if ($client->isPeriodical()) {
         $storePeriodical = $this->storeClientPeriodical($clientPeriodical);
         if (!$storePeriodical) {
             if (!is_null($backUrl)) {
                 header("Location: " . $backUrl);
                 return true;
             }
             return false;
         }
         $client->setPeriodicalid($clientPeriodical->getId());
         $periodicalStore = true;
     }
     if ($client->isPeriodical() && !$insert || !$client->isPeriodical()) {
         $store = $this->storeClient($client);
         if (!$store) {
             if (!is_null($backUrl)) {
                 header("Location: " . $backUrl);
                 return true;
             }
             return false;
         }
         if ($insert) {
             $eventHistory = new EventHistory();
             $eventHistory->setPid($client->getPid());
             $eventHistory->setCid($client->getId());
             $eventHistory->setR_date($client->getR_date());
             $eventHistory->setDescription("Sukurtas projekto vadovo");
             $this->storeEventHistory($eventHistory);
         }
         $clientStore = true;
     }
     if ($periodicalStore && !$clientStore) {
         $this->context->setRequestScopeAttr("success", "Periodinis klientas suskurtas sÄ—kmingai.");
     }
     $this->cancelClientEdit();
     if (!is_null($backUrl)) {
         header("Location: " . $backUrl);
         return true;
     }
     return false;
 }
 function test_client_update()
 {
     //Arrange
     $name = "Vidal Sassoon";
     $test_stylist = new Stylist($name);
     $test_stylist->save();
     $name1 = "Mr. T";
     $stylist_id = $test_stylist->getId();
     $test_client = new Client($name1, $stylist_id, null);
     $test_client->save();
     $new_name = "Clubber Lang";
     //Act
     $test_client->update($new_name);
     //Assert
     $this->assertEquals($new_name, $test_client->getName());
 }
Example #26
0
function session_resume_html(PDO &$connection, Client &$_local_client)
{
    if (!$connection) {
        throw new Exception('Unable to render session resume with invalid PDO connection');
    } else {
        if (!$_local_client->status()) {
            ?>
        <section class="main">
            <header>
                <h1>MW3Guard WebAPI 1.5.0</h1>
                <p>You'r not supposed to be here..!</p>
            </header>
        </section>
        <?php 
        }
    }
    $nbReportAvailable = MAXIMUM_REPORT_PER_CLIENT - $_local_client->get_report_count();
    ?>
        <div id="sResume">
        <section class="main">
        <header>
            <h1><?php 
    echo $_local_client->getSessionName();
    ?>
</h1>
            <p>Welcome <?php 
    echo $_local_client->getName();
    ?>
. <br/>
                <?php 
    if ($_local_client->isSU()) {
        ?>
You are the super user in this session, <br/>you can either report or kick!<?php 
    } else {
        ?>
You can report <?php 
        echo $nbReportAvailable;
        ?>
 time(s) for this session.</p><?php 
    }
    ?>
        </header>
        
        <table>
            <thead>
                <tr>
                    <td>Names</td>
                    <td>Score</td>
                </tr>
            </thead>
            <tbody>
        
        <?php 
    $req = 'SELECT client_id, client_psn, leaderboard_score, acs_level, acs_prestige ' . 'FROM CLIENTS JOIN SESSIONS ON client_session=session_token ' . 'WHERE client_status = true ' . 'AND client_session = ? ' . 'AND session_status = true';
    $stmt = $connection->prepare($req);
    $cSession = $_local_client->getSessionToken();
    $stmt->bindParam(1, $cSession, PDO::PARAM_STR, 64);
    if ($stmt->execute()) {
        while ($data = $stmt->fetch()) {
            ?>
                <tr>
                    <td><?php 
            level_image_associated_html($data['acs_level'], $data['acs_prestige']);
            ?>
<a href="#client<?php 
            echo $data['client_id'];
            ?>
"><?php 
            echo $data['client_psn'];
            ?>
</a></td>
                    <td><?php 
            echo $data['leaderboard_score'];
            ?>
</td>
                </tr>
                <?php 
        }
    }
    ?>
            </tbody>
        </table>
        </section></div>
                <?php 
}
Example #27
0
<?php

function __autoload($class_name)
{
    include 'classes/polymorphism/' . $class_name . '.php';
}
$patient = new Patient("Brian");
echo $patient->getName() . "<br><br>";
$client2 = new Client("Bob");
echo $client2->getName();
//$client->
// Other common uses, getProducts() vs getProducts("electronics") vs getProducts("electronics", 10)