Пример #1
0
 public function Save(Location $location)
 {
     try {
         $SQL = self::$INSERT;
         if ($location->getSeq() != null && $location->getSeq() != "" && $location->getSeq() > 0) {
             $SQL = self::$UPDATE;
         }
         $conn = self::$db->getConnection();
         $stmt = $conn->prepare($SQL);
         $stmt->bindValue(':name', $location->getLocationName());
         $stmt->bindValue(':locationfolder', $location->getLocationFolder());
         $stmt->bindValue(':details', $location->getLocationDetails());
         $isPrivate = 0;
         if ($location->getIsPrivate() == true || $location->getIsPrivate() == 1) {
             $isPrivate = 1;
         }
         $stmt->bindValue(':hasdirectory', $location->getHasDirectory());
         $stmt->bindValue(':isprivate', $isPrivate);
         if ($SQL == self::$UPDATE) {
             $stmt->bindValue(':locationSeq', $location->getSeq());
         }
         $stmt->execute();
         $error = $stmt->errorInfo();
         if ($error[2] != "") {
             throw new Exception($error[2]);
         }
     } catch (Exception $e) {
         $logger = Logger::getLogger($ConstantsArray["logger"]);
         $logger->error("Error During Save Location : - " . $e->getMessage());
     }
     //I will be put code here for throw exception and show on the screen
 }
Пример #2
0
        <td class="ui-widget-content">
            <form name="frm1" method="post" action="CreateLocation.php">
            <input type="hidden" name="seq" id="seq" value="<?php 
echo $location->getSeq();
?>
" /> 
             <input type="hidden" name="folderName" id="folderName" value="<?php 
echo $location->getLocationFolder();
?>
" />    
                <table width="100%" border="0" style="padding:10px 10px 10px 10px;">                
                    
                  <tr>
                    <td width="22%">Location Name :</td>
                    <td width="40%"><input name="location" type="text" size="50" value="<?php 
echo $location->getLocationName();
?>
" >
                    </td><td><span style="color:#FF0000; margin-bottom:15px;" >*</span></td>
                  </tr>
                  <tr>
                    <td>Location Details :</td>
                    <td><textarea name="details" id="details" cols="38" rows="4" ><?php 
echo $location->getLocationDetails();
?>
</textarea>
                      &nbsp;</td>
                  </tr>
                  <tr>
                    <td>Create Directory</td>
                    <?php 
Пример #3
0
 public function equals(Location $location)
 {
     return $this->getLocationName() == $location->getLocationName();
 }
 public function update(Location $loc)
 {
     $query = "UPDATE `location` SET `location_name`='" . $loc->getLocationName() . "',`location_city`='" . $loc->getLocationCity() . "',`longitude`='" . $loc->getLongitude() . "',`latitude`='" . $loc->getLatitude() . "',`altitude`='" . $loc->getAltitude() . "' WHERE `idlocation`='" . $loc->getLocationId() . "'";
     $this->con->openConnection();
     $this->con->executeRawQuery($query);
     $this->con->closeConnection();
 }