Example #1
0
 function test_getClientName()
 {
     //Arrange
     $client_name = "Ted";
     $stylist_id = 1;
     $test_client = new Client($client_name, $stylist_id);
     //Act
     $result = $test_client->getClientName();
     //Assert
     $this->assertEquals($client_name, $result);
 }
Example #2
0
 function test_setClientName()
 {
     $client_name = "Bob Rails";
     $id = 3;
     $email = "*****@*****.**";
     $stylist_id = null;
     $test_client = new Client($client_name, $id, $email, $stylist_id);
     $test_client->setClientName("Terra Code");
     $result = $test_client->getClientName();
     $this->assertEquals("Terra Code", $result);
 }
Example #3
0
 function test_update()
 {
     $name = "Megan";
     $id = null;
     $test_stylist = new Stylist($name, $id);
     $test_stylist->save();
     $client_name = "Shawnee";
     $stylist_id = $test_stylist->getId();
     $test_client = new Client($id, $client_name, $stylist_id);
     $test_client->save();
     $new_client_name = "Katie Saccomanno";
     $test_client->update($new_client_name);
     $this->assertEquals("Katie Saccomanno", $test_client->getClientName());
 }
Example #4
0
 function test_getClientName()
 {
     //Arrange
     $stylist_name = "Donna";
     $id = null;
     $test_stylist = new Stylist($stylist_name, $id);
     $test_stylist->save();
     $client_name = "Robin";
     $stylist_id = $test_stylist->getId();
     $test_client = new Client($client_name, $stylist_id);
     $test_client->save();
     //Act
     $result = $test_client->getClientName();
     //Assert
     $this->assertEquals($client_name, $result);
 }
Example #5
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);
 }
 function test_update()
 {
     //Arrange
     $stylist_name = "gary";
     $id = null;
     $test_stylist = new Stylist($stylist_name, $id);
     $test_stylist->save();
     $client_name = "jerry";
     $stylist_id = $test_stylist->getId();
     $test_client = new Client($client_name, $id, $stylist_id);
     $test_client->save();
     $new_name = "larry";
     //Act
     $test_client->update($new_name);
     //Assert
     $this->assertEquals("larry", $test_client->getClientName());
 }
 function test_updateClientName()
 {
     //arrange
     $stylist_name = "Lisa";
     $id = null;
     $test_stylist = new Stylist($stylist_name, $id);
     $test_stylist->save();
     $client_name = "Alfred";
     $stylist_id = $test_stylist->getId();
     $test_client = new Client($client_name, $id, $stylist_id);
     $new_client_name = "Steven";
     //act
     $test_client->updateClientName($new_client_name);
     //assert
     $this->assertEquals("Steven", $test_client->getClientName());
 }
Example #8
0
 /**
  * Restore single file + Bacula ACLs
  */
 function restoreSingleFileAction()
 {
     $this->view->title = $this->view->translate->_('Restore Single File');
     $this->fileid = $this->_request->getParam('fileid', null);
     // get data for form
     Zend_Loader::loadClass('Job');
     $job = new Job();
     $this->view->file = $job->getByFileId($this->fileid);
     // do Bacula ACLs
     if (empty($this->view->file)) {
         $this->render();
         return;
     }
     Zend_Loader::loadClass('Client');
     $clients = new Client();
     /*
      * Restore options form
      */
     Zend_Loader::loadClass('FormRestoreOptions');
     $form = new formRestoreOptions();
     $form->setDecorators(array(array('ViewScript', array('viewScript' => 'decorators/formRestoreoptions.phtml', 'form' => $form))));
     $form->init();
     $form->setAction($this->view->baseUrl . '/restorejob/run-restore-single-file');
     $form->setActionCancel($this->view->baseUrl);
     // fill form
     $form->populate(array('fileid' => $this->fileid, 'client_name' => $clients->getClientName($this->view->file[0]['jobid'])));
     $this->view->form = $form;
     $this->render();
 }
Example #9
0
 function test_update()
 {
     //Arrange
     $client_name = "Paco";
     $id = null;
     $stylist_id = 2;
     $test_client = new Client($client_name, $id, $stylist_id);
     $test_client->save();
     $new_client_name = "Pablo";
     //Act
     $test_client->update($new_client_name);
     //Assert
     $this->assertEquals("Pablo", $test_client->getClientName());
 }
Example #10
0
 function test_update()
 {
     //Arrange
     $stylist_name = "Ed Scissorhands";
     $id = null;
     $test_stylist = new Stylist($stylist_name, $id);
     $test_stylist->save();
     $client_name = "Bed Head";
     $stylist_id = $test_stylist->getId();
     $test_client = new Client($client_name, $id, $stylist_id);
     $test_client->save();
     $new_name = "Hairy Carey";
     //Act
     $test_client->update($new_name);
     //Assert
     $this->assertEquals("Hairy Carey", $test_client->getClientName());
 }
Example #11
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 #12
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 
    }
Example #13
0
 function test_update()
 {
     //Arrange
     $stylist_name = "Big Bird";
     $id = null;
     $test_stylist = new Stylist($stylist_name, $id);
     $test_stylist->save();
     $client_name = "Harry Potter";
     $stylist_id = $test_stylist->getId();
     $test_client = new Client($client_name, $stylist_id);
     $test_client->save();
     $new_name = "Spock";
     //Act
     $test_client->update($new_name);
     //Assert
     $this->assertEquals("Spock", $test_client->getClientName());
 }