예제 #1
0
	<p>
		<label for="title">Title:</label>
		<input type="text" name="title" id="title">
	</p>
	<p>
		<label for="description">Description:</label>
		<textarea name="description" id="description"></textarea>
	</p>
	<p>
		<input type="submit" name="send" id="send" value="Send">
	</p>
</form>


<pre>
	
	<?php 
require_once 'Record.php';
if (isset($_POST['name']) && $_POST['name'] != '') {
    $myRecord = new Record();
    $myRecord->setName($_POST['name']);
    echo "The name of this record  is: ";
    $myRecord->getName();
} else {
    echo "Please enter the name of your record!";
}
?>
</pre>

</body>
</html>
예제 #2
0
 /**
  * Edit
  */
 public function executeEdit()
 {
     if ($this->isGET()) {
         return $this->renderJson(array("success" => false, "info" => "POST only."));
     } else {
         $ids = array();
         foreach ($this->getRequestParameter('record') as $data) {
             if (!($record = RecordPeer::retrieveByPK($data['id']))) {
                 $record = new Record();
                 $record->setDomainId($this->domain->getId());
             }
             $record->setName($data['name']);
             $record->setType($data['type']);
             $record->setContent($data['content']);
             $record->setTtl($data['ttl']);
             if ($data['type'] == 'MX' || $data['type'] == 'SRV') {
                 $record->setPrio($data['prio']);
             }
             $record->save();
             $ids[] = $record->getId();
         }
         $c = new Criteria();
         $c->add(RecordPeer::DOMAIN_ID, $this->domain->getId());
         $c->add(RecordPeer::ID, $ids, Criteria::NOT_IN);
         foreach (RecordPeer::doSelect($c) as $record) {
             $record->delete();
         }
         return $this->renderJson(array("success" => true, "info" => "Domain updated."));
     }
 }
예제 #3
0
 /**
  * Create Record instance from array.
  *
  * @param array $array
  *
  * @return Record
  */
 public static function createFromArray($array)
 {
     $r = new Record();
     $r->setId($array['id']);
     $r->setName($array['name']);
     $r->setContent($array['content']);
     $r->setTtl($array['ttl']);
     $r->setType($array['type']);
     $r->setPriority($array['priority']);
     $r->setDomainId($array['domain_id']);
     $r->setGeoRegionId($array['geo_region_id']);
     $r->setGeoLock($array['geo_lock']);
     $r->setGeoLong($array['geo_long']);
     $r->setGeoLat($array['geo_lat']);
     $r->setFailoverEnabled($array['failover_enabled']);
     $r->setFailoverContent($array['failover_content']);
     $r->setFailoverWithdraw($array['failover_withdraw']);
     $r->setActive($array['is_active']);
     $r->setUdpLimit($array['udp_limit']);
     return $r;
 }