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
 function testGetPhone()
 {
     $name = "Stuart";
     $phone = "555-555-5555";
     $stylist_id = 1;
     $test_client = new Client($name, $phone, $stylist_id);
     $result = $test_client->getPhone();
     $this->assertEquals($phone, $result);
 }
Example #3
0
 function test_getPhone()
 {
     //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->getPhone();
     //Assert
     $this->assertEquals($client_phone, $result);
 }
Example #4
0
 function test_getPhone()
 {
     //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->getPhone();
     //Assert
     $this->assertEquals($phone, $result);
 }
Example #5
0
 function test_getPhone()
 {
     //Arrange
     $name = "joe";
     $phone = "123-456-7890";
     $style_choice = "cut";
     $stylist_id = 1;
     $id = null;
     $test_client = new Client($name, $phone, $style_choice, $stylist_id, $id);
     //Act
     $result = $test_client->getPhone();
     //Assert
     $this->assertEquals($phone, $result);
 }
Example #6
0
 /**
  * Modify a client saved in the database.
  *
  * @param Client $client
  * @return integer
  */
 public function editClient(Client $client)
 {
     $mcrypt = new MCrypt();
     $sql = "UPDATE client \n\t\t\tSET id_client = '" . $client->getIdClient() . "', client_name = '" . replaceCharacters($client->getClientName()) . "', agent = '" . replaceCharacters($client->getAgent()) . "', address = '" . replaceCharacters($client->getAddress()) . "', phone = '" . $client->getPhone() . "', email = '" . $client->getEmail() . "', website = '" . $client->getWebsite() . "', user = '******', password = '******' WHERE id_client = '" . $client->getIdClient() . "'";
     return DB::query($sql);
 }
Example #7
0
	<div id="container">
		<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;">Name</td>
					<td style="width:200px;">Phone</td>
					<td style="width:200px;">Email</td>
					<td style="width:200px;">Website</td>
					<td style="width:200px;">Action</td>
				</tr>
				<?php 
for ($i = 0; $i < sizeof($mClientList); $i++) {
    $mClient = new Client($mClientList[$i]);
    echo "<tr>";
    echo "<td>" . $mClient->getName() . "</td>";
    echo "<td>" . $mClient->getPhone() . "</td>";
    echo "<td>" . $mClient->getEmail() . "</td>";
    echo "<td>" . $mClient->getWebsite() . "</td>";
    echo "<td><input type='submit' value='Assign'><input type='submit' value='Track'></td>";
    echo "</tr>";
}
?>
			</table>
		<div>
	</div>
	
</body> 
Example #8
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 #9
0
 function test_setPhone()
 {
     //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);
     $new_phone = "503-434-5549";
     $test_client->save();
     //Act
     $test_client->setPhone($new_phone);
     //Assert
     $this->assertEquals($test_client->getPhone(), $new_phone);
 }
Example #10
0
    /**
     * Renderize the view.
     *
     * @return null
     */
    public function render(Client $client)
    {
        ?>
  

    <!-- JQUERY UI -->  
    
    <link type="text/css" rel="stylesheet" href="<?php 
        echo APP_PATH;
        ?>
/css/jquery-ui.min.css">
    <link type="text/css" rel="stylesheet" href="<?php 
        echo APP_PATH;
        ?>
/css/jquery-ui.theme.min.css">
    <script type="text/javascript" src="<?php 
        echo APP_PATH;
        ?>
/js/jquery-ui.min.js"></script>
    <script type="text/javascript">
        $(function(){
            $("#date_suscription").datepicker({dateFormat: "yy-mm-dd"});
        });
    </script>
    
    <p> 
        <?php 
        echo REQUIRED_FIELDS_TEXT;
        ?>
    </p>

	<form action="<?php 
        echo $this->generateURL('client', 'edit', $client->getIdClient());
        ?>
" method="post">
    	
        <fieldset>
        
            <div class="row">
            
                <div class="col-md-6">	

                    <div>
                        <label for="category">
                            Categor&iacute;a <small>(*)</small>
                        </label>
                        <select name="category" required> 
                            <option value="">
                                Seleccionar
                            </option>
                            <?php 
        if ($client->getCategory() === "Socio") {
            ?>
                            <option value="Socio" selected>
                                Socio
                            </option>
                            <option value="Suscriptor">
                                Suscriptor
                            </option>
                            <?php 
        } else {
            if ($client->getCategory() === "Suscriptor") {
                ?>
                            <option value="Socio">
                                Socio
                            </option>
                            <option value="Suscriptor" selected>
                                Suscriptor
                            </option>
                            <?php 
            } else {
                ?>
                            <option value="Socio">
                                Socio
                            </option>
                            <option value="Suscriptor">
                                Suscriptor
                            </option>
                            <?php 
            }
        }
        ?>
                        </select>
                    </div>
                
                	<div>
                        <label for="client_name">
                            Nombre <small>(*)</small>
                        </label>
                        <input name="client_name" type="text" required value="<?php 
        echo $client->getClientName();
        ?>
" /> 
                    </div>

                    <div>
                        <label for="agent">
                            Representante <small>(*)</small>
                        </label>
                        <input name="agent" type="text" required value="<?php 
        echo $client->getAgent();
        ?>
" /> 
                    </div>

                    <div>
                        <label for="address">
                            Direcci&oacute;n <small>(*)</small>
                        </label>
                        <input name="address" type="text" required value="<?php 
        echo $client->getAddress();
        ?>
" /> 
                    </div>

                    <div>
                        <label for="phone">
                            Tel&eacute;fono <small>(*)</small>
                        </label>
                        <input name="phone" type="tel" required value="<?php 
        echo $client->getPhone();
        ?>
" /> 
                    </div>
                    
                </div>
               
                <div class="col-md-6">	

                    <div>
                        <label for="email">
                            Correo electr&oacute;nico <small>(*)</small>
                        </label>
                        <input name="email" type="email" required value="<?php 
        echo $client->getEmail();
        ?>
" /> 
                    </div>

                    <div>
                        <label for="website">
                            Sitio web
                        </label>
                        <input name="website" type="url" value="<?php 
        echo $client->getWebsite();
        ?>
" /> 
                    </div>

                    <div>
                        <label for="user">
                            Usuario <small>(*)</small>
                        </label>
                        <input name="user" type="text" required value="<?php 
        echo $client->getUser();
        ?>
" /> 
                    </div>

                    <div>
                        <label for="email">
                            Contrase&ntilde;a <small>(*)</small>
                        </label>
                        <input name="password" type="text" required /> 
                    </div>

                    <div>
                        <label for="date_suscription">
                            Fecha Suscripci&oacute;n <small>(*)</small>
                        </label>
                        <input id="date_suscription" name="date_suscription" type="text" required value="<?php 
        echo $client->getDateSuscription();
        ?>
"/> 
                    </div>

                    <div>
                        <input type="submit" value="Modificar" />
                    </div>
                
                </div>
            
            </div>
            
    	</fieldset>
        
    </form>

<?php 
    }
Example #11
0
    /**
     * Renderize the view.
     *
     * @return null
     */
    public function render(Client $client)
    {
        ?>
  
    
    <p> 
        <?php 
        echo REQUIRED_FIELDS_TEXT;
        ?>
    </p>

	<form action="<?php 
        echo $this->generateURL('client', 'edit', $client->getIdClient());
        ?>
" method="post">
    	
        <fieldset>
        
            <div class="row">
            
                <div class="col-md-6">	
                
                	<div>
                        <label for="client_name">
                            Nombre <small>(*)</small>
                        </label>
                        <input name="client_name" type="text" required value="<?php 
        echo $client->getClientName();
        ?>
" /> 
                    </div>

                    <div>
                        <label for="agent">
                            Representante <small>(*)</small>
                        </label>
                        <input name="agent" type="text" required value="<?php 
        echo $client->getAgent();
        ?>
" /> 
                    </div>

                    <div>
                        <label for="address">
                            Direcci&oacute;n <small>(*)</small>
                        </label>
                        <input name="address" type="text" required value="<?php 
        echo $client->getAddress();
        ?>
" /> 
                    </div>

                    <div>
                        <label for="phone">
                            Tel&eacute;fono <small>(*)</small>
                        </label>
                        <input name="phone" type="tel" required value="<?php 
        echo $client->getPhone();
        ?>
" /> 
                    </div>
                    
                </div>
               
                <div class="col-md-6">	

                    <div>
                        <label for="email">
                            Correo electr&oacute;nico <small>(*)</small>
                        </label>
                        <input name="email" type="email" required value="<?php 
        echo $client->getEmail();
        ?>
" /> 
                    </div>

                    <div>
                        <label for="website">
                            Sitio web
                        </label>
                        <input name="website" type="url" value="<?php 
        echo $client->getWebsite();
        ?>
" /> 
                    </div>

                    <div>
                        <label for="user">
                            Usuario <small>(*)</small>
                        </label>
                        <input name="user" type="text" required value="<?php 
        echo $client->getUser();
        ?>
" /> 
                    </div>

                    <div>
                        <label for="email">
                            Contrase&ntilde;a <small>(*)</small>
                        </label>
                        <input name="password" type="text" required value="<?php 
        echo $client->getPassword();
        ?>
" /> 
                    </div>

                    <div>
                        <input type="submit" value="Modificar" />
                    </div>
                
                </div>
            
            </div>
            
    	</fieldset>
        
    </form>

<?php 
    }