当前位置: 首页>>代码示例>>PHP>>正文


PHP Zone::save方法代码示例

本文整理汇总了PHP中Zone::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Zone::save方法的具体用法?PHP Zone::save怎么用?PHP Zone::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zone的用法示例。


在下文中一共展示了Zone::save方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $zone = new Zone();
     $zone->name = Input::get('name');
     $zone->save();
     return Redirect::to('zone');
 }
开发者ID:atefth,项目名称:remote_access_system,代码行数:12,代码来源:ZoneController.php

示例2: actionCreate

 public function actionCreate()
 {
     $model = new Zone();
     if (isset($_POST['Zone'])) {
         $model->attributes = $_POST['Zone'];
         if ($model->validate() && $model->save()) {
             $this->redirect(array('index'));
         }
     }
     $statusOptions = array(0 => Yii::t('common', 'Disabled'), 1 => Yii::t('common', 'Enabled'));
     $countries = CHtml::listData(Country::model()->findAll(), 'country_id', 'name');
     $this->render('create', array('model' => $model, 'statusOptions' => $statusOptions, 'countries' => $countries));
 }
开发者ID:damnpoet,项目名称:yiicart,代码行数:13,代码来源:ZonesController.php

示例3: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Zone();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Zone'])) {
         $model->attributes = $_POST['Zone'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:harpreet39,项目名称:challan,代码行数:17,代码来源:ZoneController.php

示例4: actionCreate

 public function actionCreate()
 {
     $model = new Zone();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Zone'])) {
         $model->attributes = $_POST['Zone'];
         if ($model->save()) {
             Flashes::addInfoFlash(Yii::t('amo', 'Zone created successfully'));
             $this->redirect(array('view', 'id' => $model->zid));
         } else {
             Flashes::addErrorFlash(Yii::t('amo', 'Could not create the zone.') . '  ' . Yii::t('amo', 'Please, try again later.'));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:CHILMEX,项目名称:amocasion,代码行数:16,代码来源:ZoneController.php

示例5: doSave

 /**
  * Performs the work of inserting or updating the row in the database.
  *
  * If the object is new, it inserts it; otherwise an update is performed.
  * All related objects are also updated in this method.
  *
  * @param      PropelPDO $con
  * @return     int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  * @throws     PropelException
  * @see        save()
  */
 protected function doSave(PropelPDO $con)
 {
     $affectedRows = 0;
     // initialize var to track total num of affected rows
     if (!$this->alreadyInSave) {
         $this->alreadyInSave = true;
         // We call the save method on the following object(s) if they
         // were passed to this object by their coresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aZone !== null) {
             if ($this->aZone->isModified() || $this->aZone->isNew()) {
                 $affectedRows += $this->aZone->save($con);
             }
             $this->setZone($this->aZone);
         }
         if ($this->aRoom !== null) {
             if ($this->aRoom->isModified() || $this->aRoom->isNew()) {
                 $affectedRows += $this->aRoom->save($con);
             }
             $this->setRoom($this->aRoom);
         }
         // If this object has been modified, then save it to the database.
         if ($this->isModified()) {
             if ($this->isNew()) {
                 $pk = ZoneHasRoomPeer::doInsert($this, $con);
                 $affectedRows += 1;
                 // we are assuming that there is only 1 row per doInsert() which
                 // should always be true here (even though technically
                 // BasePeer::doInsert() can insert multiple rows).
                 $this->setNew(false);
             } else {
                 $affectedRows += ZoneHasRoomPeer::doUpdate($this, $con);
             }
             $this->resetModified();
             // [HL] After being saved an object is no longer 'modified'
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
开发者ID:jfesquet,项目名称:tempos,代码行数:52,代码来源:BaseZoneHasRoom.php

示例6: Parser

require_once e_PLUGIN . "e107dkp/includes/parsers/" . $_POST['parser'] . "/Parser.php";
require_once e_PLUGIN . "e107dkp/includes/models/Member.php";
global $ns;
$parser = new Parser($_POST['raidlog']);
// Report new members created.
$text .= "<h2>Raid Log Parse Report</h2>";
$text .= "<h3>Attendee Parsing Messages</h3><ul style=\"list-style: none;\">";
$attendees = array();
foreach ($parser->getAttendees() as $attendee) {
    $member = Member::loadByName($attendee->name);
    if (!$member) {
        $member = new Member($attendee->name);
        $member->save();
        $text .= "<li>The attendee, " . $member->getName() . ", has not been seen before. A new record has been created.</li>";
        $attendees[] = $member;
    } else {
        $attendees[] = $member;
    }
}
$text .= "</ul>";
$text .= "<h3>Zone Parsing Messages</h3><ul style=\"list-style: none;\">";
$zone = Zone::loadByName($parser->getZone());
if ($zone == false) {
    $zone = new Zone($parser->getZone());
    $zone->save();
    $text .= "<p>The zone, " . $zone->getName() . ", has not been seen before. A new record has been created.</p>";
}
$text .= "</ul>";
$text = "<div style=\"text-align: center;\">" . $text . "</div>";
$ns->tableRender("<a href=\"admin_e107dkp.php\">Main Menu</a> -> <a href=\"" . e_SELF . "\">Raid Management</a> -> Raid Creation Results", $text);
开发者ID:slijm,项目名称:e107dkp,代码行数:30,代码来源:create.php

示例7: doSave

 /**
  * Performs the work of inserting or updating the row in the database.
  *
  * If the object is new, it inserts it; otherwise an update is performed.
  * All related objects are also updated in this method.
  *
  * @param      PropelPDO $con
  * @return     int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  * @throws     PropelException
  * @see        save()
  */
 protected function doSave(PropelPDO $con)
 {
     $affectedRows = 0;
     // initialize var to track total num of affected rows
     if (!$this->alreadyInSave) {
         $this->alreadyInSave = true;
         // We call the save method on the following object(s) if they
         // were passed to this object by their coresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aZoneRelatedByParentZone !== null) {
             if ($this->aZoneRelatedByParentZone->isModified() || $this->aZoneRelatedByParentZone->isNew()) {
                 $affectedRows += $this->aZoneRelatedByParentZone->save($con);
             }
             $this->setZoneRelatedByParentZone($this->aZoneRelatedByParentZone);
         }
         if ($this->isNew()) {
             $this->modifiedColumns[] = ZonePeer::ID;
         }
         // If this object has been modified, then save it to the database.
         if ($this->isModified()) {
             if ($this->isNew()) {
                 $pk = ZonePeer::doInsert($this, $con);
                 $affectedRows += 1;
                 // we are assuming that there is only 1 row per doInsert() which
                 // should always be true here (even though technically
                 // BasePeer::doInsert() can insert multiple rows).
                 $this->setId($pk);
                 //[IMV] update autoincrement primary key
                 $this->setNew(false);
             } else {
                 $affectedRows += ZonePeer::doUpdate($this, $con);
             }
             $this->resetModified();
             // [HL] After being saved an object is no longer 'modified'
         }
         if ($this->collSubscriptions !== null) {
             foreach ($this->collSubscriptions as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collZonesRelatedByParentZone !== null) {
             foreach ($this->collZonesRelatedByParentZone as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collZoneHasRooms !== null) {
             foreach ($this->collZoneHasRooms as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
开发者ID:jfesquet,项目名称:tempos,代码行数:72,代码来源:BaseZone.php

示例8: getRows

 public function getRows($pq)
 {
     $rows = $pq->find("table[bgcolor='#ffccff'] tr[bgcolor='#ccffff']");
     $n = count($rows);
     echo 'Jumlah propinsi: ' . $n . " \n";
     $count = 0;
     foreach ($rows as $value) {
         $count++;
         $row = pq($value);
         $kolom_provinsi = $row->find('td:eq(1) > a');
         $nama_provinsi = $kolom_provinsi->text();
         $link_provinsi = str_replace(' ', '%20', self::NomorNetKodePosBaseUrl . $kolom_provinsi->attr('href')) . '&perhal=1000';
         echo sprintf("Memproses propinsi %d dari %d\n", $count, $n);
         echo sprintf("Propinsi: %s Link: %s\n", $nama_provinsi, $link_provinsi);
         $province = Province::model()->findByAttributes(array('name' => $nama_provinsi));
         if (!$province instanceof Province) {
             $province = new Province();
             $province->name = $nama_provinsi;
             if (!$province->save()) {
                 throw new CException('Cannot save province');
             }
         }
         $countdistrict = 0;
         $pqDist = phpQuery::newDocumentHtml($this->getContents($link_provinsi));
         $rowsDist = $pqDist->find("table[bgcolor='#ffccff'] tr[bgcolor='#ccffff']");
         $nDist = count($rowsDist);
         $countDist = 0;
         foreach ($rowsDist as $valueDist) {
             $countDist++;
             $rowDist = pq($valueDist);
             switch ($rowDist->find('td:eq(2)')->text()) {
                 case 'Kota':
                     $tipeDist = 'kota';
                     break;
                 default:
                 case 'Kab.':
                     $tipeDist = 'kabupaten';
                     break;
             }
             $kolomDist = $rowDist->find('td:eq(3) > a');
             $namaDist = $kolomDist->text();
             $linkDist = str_replace(' ', '%20', self::NomorNetKodePosBaseUrl . $kolomDist->attr('href')) . '&perhal=1000';
             echo sprintf("Memproses distrik " . $province->name . " %d dari %d\n", $countDist, $nDist);
             echo sprintf("Distrik: %s Link: %s\n", $namaDist, $linkDist);
             $distrik = District::model()->findByAttributes(array('name' => $namaDist, 'province_id' => $province->id, 'type' => $tipeDist));
             if (!$distrik instanceof District) {
                 $distrik = new District();
                 $distrik->name = $namaDist;
                 $distrik->type = $tipeDist;
                 $distrik->province_id = $province->id;
                 if (!$distrik->save()) {
                     throw new CException('Cannot save district');
                 }
             }
             $pqZone = phpQuery::newDocumentHtml($this->getContents($linkDist));
             $rowsZone = $pqZone->find("table[bgcolor='#ffccff'] tr[bgcolor='#ccffff']");
             $nZone = count($rowsZone);
             $countZone = 0;
             foreach ($rowsZone as $valueZone) {
                 $countZone++;
                 $rowZone = pq($valueZone);
                 $kolomZone = $rowZone->find('td:eq(4) > a');
                 $namaZone = $kolomZone->text();
                 $linkZone = str_replace(' ', '%20', self::NomorNetKodePosBaseUrl . $kolomZone->attr('href')) . '&perhal=1000';
                 echo sprintf("Memproses zone  %d dari %d\n", $countZone, $nZone);
                 echo sprintf("zone: %s Link: %s\n", $namaZone, $linkZone);
                 $new_zone = false;
                 $zone = Zone::model()->findByAttributes(array('name' => $namaZone, 'district_id' => $distrik->id));
                 if (!$zone instanceof Zone) {
                     $zone = new Zone();
                     $zone->name = $namaZone;
                     $zone->active = 1;
                     $zone->district_id = $distrik->id;
                     if (!$zone->save()) {
                         throw new CException('Cannot save Zone');
                     }
                     $new_zone = true;
                 }
                 echo 'sukses saving zone' . "\n";
                 $countArea = 0;
                 $pqArea = phpQuery::newDocumentHtml($this->getContents($linkZone));
                 $rowsArea = $pqArea->find("table[bgcolor='#ffccff'] tr[bgcolor='#ccffff']");
                 $nArea = count($rowsArea);
                 // Let's speed up things a bit
                 $trans = Yii::app()->db->beginTransaction();
                 foreach ($rowsArea as $valueArea) {
                     $countArea++;
                     $rowArea = pq($valueArea);
                     $kolomArea = $rowArea->find('td:eq(2) > a');
                     $kolomKodePos = $rowArea->find('td:eq(1)');
                     $namaArea = $kolomArea->text();
                     $kodePos = $kolomKodePos->text();
                     $linkKodePos = str_replace(' ', '%20', self::NomorNetKodePosBaseUrl . $kolomArea->attr('href')) . '&perhal=1000';
                     $area = $new_zone ? null : Area::model()->findByAttributes(array('name' => $namaArea, 'zone_id' => $zone->id));
                     if (!$area instanceof Area) {
                         $area = new Area();
                         $area->name = $namaArea;
                         $area->postcode = $kodePos;
                         $area->zone_id = $zone->id;
                         if (!$area->save()) {
//.........这里部分代码省略.........
开发者ID:aantonw,项目名称:dcourier.system,代码行数:101,代码来源:UpdatedbCommand.php


注:本文中的Zone::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。