當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Site::save方法代碼示例

本文整理匯總了PHP中Site::save方法的典型用法代碼示例。如果您正苦於以下問題:PHP Site::save方法的具體用法?PHP Site::save怎麽用?PHP Site::save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Site的用法示例。


在下文中一共展示了Site::save方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: actionCreate

 public function actionCreate()
 {
     $typeId = Yii::app()->request->getParam('typeId', 0);
     $model = new Site();
     $model->dpid = $this->companyId;
     $model->type_id = $typeId;
     if (Yii::app()->request->isPostRequest) {
         $model->attributes = Yii::app()->request->getPost('Site');
         $se = new Sequence("site");
         $model->lid = $se->nextval();
         $model->create_at = date('Y-m-d H:i:s', time());
         $model->update_at = date('Y-m-d H:i:s', time());
         $model->delete_flag = '0';
         //var_dump($model);exit;
         if ($model->save()) {
             Yii::app()->user->setFlash('success', yii::t('app', '添加成功'));
             $this->redirect(array('site/index', 'typeId' => $typeId, 'companyId' => $this->companyId));
         }
     }
     $types = $this->getTypes();
     $floors = $this->getFloors();
     $sitepersons = $this->getSitePersons();
     //var_dump($floors);
     //var_dump($types);exit;
     $this->render('create', array('model' => $model, 'types' => $types, 'floors' => $floors, 'sitepersons' => $sitepersons));
 }
開發者ID:song-yuan,項目名稱:wymenujp,代碼行數:26,代碼來源:SiteController.php

示例2: save

 public static function save()
 {
     $params = $_POST;
     $v = new Valitron\Validator($params);
     $v->rule('required', 'site_name');
     $v->rule('lengthMin', 'site_name', 5);
     $v->rule('numeric', 'latitude');
     $v->rule('required', 'latitude');
     $v->rule('lengthMin', 'latitude', 4);
     $v->rule('lengthMax', 'latitude', 7);
     $v->rule('numeric', 'latitude');
     $v->rule('required', 'longitude');
     $v->rule('lengthMin', 'longitude', 4);
     $v->rule('lengthMax', 'longitude', 7);
     $v->rule('numeric', 'longitude');
     $v->rule('required', 'area');
     $v->rule('required', 'tent');
     $v->rule('required', 'grade');
     $attributes = array('site_name' => $params['site_name'], 'latitude' => $params['latitude'], 'longitude' => $params['longitude'], 'area' => $params['area'], 'tent' => $params['tent'], 'grade' => $params['grade'], 'user_id' => $_SESSION['user'], 'content' => $params['content']);
     if ($v->validate()) {
         $attributes = array('site_name' => $params['site_name'], 'latitude' => $params['latitude'], 'longitude' => $params['longitude'], 'area' => $params['area'], 'tent' => $params['tent'], 'grade' => $params['grade'], 'user_id' => $_SESSION['user'], 'content' => $params['content']);
         $site = new Site($attributes);
         $site->save();
         Redirect::to('/site/show_site/' . $site->id, array('message' => 'Uusi telttapaikka on luotu!'));
     } else {
         View::make('site/new_site.html', array('errors' => $v->errors(), 'attributes' => $attributes, 'message' => 'Annetuissa tiedoissa puutteita tai virheitä'));
     }
 }
開發者ID:rohamo,項目名稱:Tsoha-Bootstrap,代碼行數:28,代碼來源:sites_controller.php

示例3: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $site = new Site();
     $site->name = Input::get('name');
     $site->save();
     return Redirect::to('site');
 }
開發者ID:atefth,項目名稱:remote_access_system,代碼行數:12,代碼來源:SiteController.php

示例4: create

 public function create($data, $save = true)
 {
     $site = new Site($this, $data);
     if ($save) {
         $site->save();
     }
     return $site;
 }
開發者ID:bandwidthcom,項目名稱:php-bandwidth-iris,代碼行數:8,代碼來源:Sites.php

示例5: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Site();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Site'])) {
         $model->attributes = $_POST['Site'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
開發者ID:iusedtobecat,項目名稱:sweetparticles,代碼行數:17,代碼來源:SiteInformationController.php

示例6: actionIndex

 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionIndex()
 {
     $model = Site::model()->find();
     if ($model === NULL) {
         $model = new Site();
     }
     if (isset($_POST['Site'])) {
         $model->attributes = $_POST['Site'];
         if ($model->save()) {
             Yii::app()->user->setFlash('success', '信息提交成功!');
         } else {
             Yii::app()->user->setFlash('success', '信息提交失敗!');
         }
     }
     $this->render('index', array('model' => $model));
 }
開發者ID:s-nice,項目名稱:24int,代碼行數:21,代碼來源:SiteController.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->aSite !== null) {
             if ($this->aSite->isModified() || $this->aSite->isNew()) {
                 $affectedRows += $this->aSite->save($con);
             }
             $this->setSite($this->aSite);
         }
         if ($this->aFeed !== null) {
             if ($this->aFeed->isModified() || $this->aFeed->isNew()) {
                 $affectedRows += $this->aFeed->save($con);
             }
             $this->setFeed($this->aFeed);
         }
         if ($this->isNew()) {
             $this->modifiedColumns[] = SitefeedPeer::ID;
         }
         // If this object has been modified, then save it to the database.
         if ($this->isModified()) {
             if ($this->isNew()) {
                 $pk = SitefeedPeer::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 += SitefeedPeer::doUpdate($this, $con);
             }
             $this->resetModified();
             // [HL] After being saved an object is no longer 'modified'
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
開發者ID:BasMatthee,項目名稱:symfony-profile,代碼行數:57,代碼來源:BaseSitefeed.php

示例8: setUp

 public function setUp()
 {
     parent::setUp();
     $user = User::firstOrCreate(['email' => 'quan@ll.com']);
     //if first user, create site object
     if (\User::count() == 1) {
         $site = new \Site();
         $site->name = '';
         $site->description = '';
         $site->email = $user->email;
         $site->lang = 'en-US';
         $site->create_lrs = array('super');
         $site->registration = 'Closed';
         $site->restrict = 'None';
         //restrict registration to a specific email domain
         $site->domain = '';
         $site->super = array(array('user' => $user->_id));
         $site->save();
     }
 }
開發者ID:jesposito,項目名稱:learninglocker,代碼行數:20,代碼來源:TestCase.php

示例9: handle

 public function handle($user)
 {
     //if first user, create site object
     if (\User::count() == 1) {
         $site = new \Site();
         $site->name = '';
         $site->description = '';
         $site->email = $user->email;
         $site->lang = 'en-US';
         $site->create_lrs = array('super');
         $site->registration = 'Closed';
         $site->restrict = 'None';
         //restrict registration to a specific email domain
         $site->domain = '';
         $site->super = array(array('user' => $user->_id));
         $site->save();
     }
     //now send an email asking to verify email
     $this->sendEmail($user);
 }
開發者ID:hsz-develop,項目名稱:LearningLocker--learninglocker,代碼行數:20,代碼來源:RegisterHandler.php

示例10: prepareData

 public function prepareData()
 {
     $site = new Site();
     $site->site_id = 1;
     $site->site_domain = 'site1';
     $site->save();
     $site = new Site();
     $site->site_id = 2;
     $site->site_domain = 'site2';
     $site->save();
     $var = new Variable();
     $var->variable_id = 1;
     $var->variable_name = 'var1';
     $var->save();
     $var = new Variable();
     $var->variable_id = 2;
     $var->variable_name = 'var2';
     $var->save();
     $varval = new SiteVarvalue();
     $varval->site_id = 1;
     $varval->variable_id = 1;
     $varval->varvalue_value = 'val1 dom1 var1';
     $varval->save();
     $varval = new SiteVarvalue();
     $varval->site_id = 1;
     $varval->variable_id = 2;
     $varval->varvalue_value = 'val2 dom1 var2';
     $varval->save();
     $varval = new SiteVarvalue();
     $varval->site_id = 2;
     $varval->variable_id = 1;
     $varval->varvalue_value = 'val3 dom2 var1';
     $varval->save();
     $varval = new SiteVarvalue();
     $varval->site_id = 2;
     $varval->variable_id = 2;
     $varval->varvalue_value = 'val4 dom2 var2';
     $varval->save();
 }
開發者ID:dracony,項目名稱:forked-php-orm-benchmark,代碼行數:39,代碼來源:941TestCase.php

示例11: executeSave

 function executeSave()
 {
     $request = fvRequest::getInstance();
     if (!($Site = SiteManager::getInstance()->getByPk($request->getRequestParameter('id')))) {
         $Site = new Site();
     }
     $s = $request->getRequestParameter('s');
     $Site->updateFromRequest($s);
     if ($Site->save()) {
         fvResponce::getInstance()->setHeader('Id', $Site->getPk());
         $this->setFlash("Данные успешно сохранены", self::$FLASH_SUCCESS);
         fvResponce::getInstance()->setHeader('redirect', fvSite::$fvConfig->get('dir_web_root') . $request->getRequestParameter('module') . "/?id=" . $Site->getPk());
     } else {
         fvResponce::getInstance()->setHeader('X-JSON', json_encode($Site->getValidationResult()));
         $this->setFlash("Ошибка при сохранении данных проверте правильность введенных данных", self::$FLASH_ERROR);
     }
     if (fvRequest::getInstance()->isXmlHttpRequest()) {
         return self::$FV_AJAX_CALL;
     } else {
         return self::$FV_OK;
     }
 }
開發者ID:newnamecomua,項目名稱:engineown,代碼行數:22,代碼來源:action.class.php

示例12: Site

 function Site($address)
 {
     $db = new DB();
     $this->address = $address;
     if (substr($this->address, -1, 1) == '/') {
         $this->address = substr($this->address, 0, strlen($this->address) - 1);
         // Remove trailing /
     }
     $db->query("SELECT * FROM site WHERE address = '" . $this->address . "'");
     if ($db->numRows() == 0) {
         // No record in the DB
         $db->close();
         $this->loaded = 0;
         $newad = str_replace("http://", '', $this->address);
         $newad = preg_replace('/\\/.*$/', '', $newad);
         $newad = 'http://' . $newad;
         if ($this->address == $newad) {
             $this->parent = "";
             $this->lock = 0;
         } else {
             $s = new Site($newad);
             if ($s->loaded) {
                 $this->parent = $s->sid;
                 $this->lock = $s->lock;
             } else {
                 $s->save();
             }
         }
     } else {
         $siteinfo = $db->fetchRow();
         $this->lock = $siteinfo[3];
         $this->parent = $siteinfo[1];
         $this->sid = $siteinfo[0];
         $db->close();
         $this->loaded = 1;
     }
 }
開發者ID:ranok,項目名稱:wiki-wide-web,代碼行數:37,代碼來源:site.class.php

示例13: die

if (!isset($_SESSION['uid'])) {
    die('Sorry, you need to be logged in to edit pages');
}
if ($_POST['address'] == '' || $_POST['source'] == '') {
    die('Sorry, there was an error recieving all the fields');
}
$s = new Site($_POST['address']);
if (!$s->loaded) {
    $s->checkWWW();
}
if ($s->lock) {
    print "Sorry, this page is locked";
    die;
}
if (!$s->loaded) {
    $s->save();
}
$ip = $_SERVER['REMOTE_ADDR'];
$rating = 0;
$comment = htmlentities($_POST['comment']);
$source = str_replace("\r", '', WikiWideWebize($s, getSource($_POST['address'])));
$source = str_replace(" />", ">", $source);
$nsource = str_replace("\r", '', stripslashes($_POST['source']));
$nsource = str_replace(" />", ">", $nsource);
$nsource = preg_replace("/<\\/?([A-Z]+)[^>]*>/Ue", "strtolower('\$1')", $nsource);
$source = preg_replace("/<\\/?([A-Z]+)[^>]*>/Ue", "strtolower('\$1')", $source);
$source2 = explode("\n", $source);
$source = explode("\n", entityScrub($source));
$nsource = explode("\n", $nsource);
$diff = array_diff($nsource, $source);
$diff2 = array_diff($source, $nsource);
開發者ID:ranok,項目名稱:wiki-wide-web,代碼行數:31,代碼來源:doEdit.php

示例14: testHABTMKeepExistingAlternateDataFormat

 /**
  * testHABTMKeepExistingAlternateDataFormat
  *
  * @return void
  */
 public function testHABTMKeepExistingAlternateDataFormat()
 {
     $this->loadFixtures('Site', 'Domain', 'DomainsSite');
     $Site = new Site();
     $expected = array(array('DomainsSite' => array('id' => 1, 'site_id' => 1, 'domain_id' => 1, 'active' => true, 'created' => '2007-03-17 01:16:23')), array('DomainsSite' => array('id' => 2, 'site_id' => 1, 'domain_id' => 2, 'active' => true, 'created' => '2007-03-17 01:16:23')));
     $result = $Site->DomainsSite->find('all', array('conditions' => array('DomainsSite.site_id' => 1), 'fields' => array('DomainsSite.id', 'DomainsSite.site_id', 'DomainsSite.domain_id', 'DomainsSite.active', 'DomainsSite.created'), 'order' => 'DomainsSite.id'));
     $this->assertEquals($expected, $result);
     $time = date('Y-m-d H:i:s');
     $data = array('Site' => array('id' => 1), 'Domain' => array(array('site_id' => 1, 'domain_id' => 3, 'created' => $time), array('id' => 2, 'site_id' => 1, 'domain_id' => 2)));
     $Site->save($data);
     $expected = array(array('DomainsSite' => array('id' => 2, 'site_id' => 1, 'domain_id' => 2, 'active' => true, 'created' => '2007-03-17 01:16:23')), array('DomainsSite' => array('id' => 7, 'site_id' => 1, 'domain_id' => 3, 'active' => false, 'created' => $time)));
     $result = $Site->DomainsSite->find('all', array('conditions' => array('DomainsSite.site_id' => 1), 'fields' => array('DomainsSite.id', 'DomainsSite.site_id', 'DomainsSite.domain_id', 'DomainsSite.active', 'DomainsSite.created'), 'order' => 'DomainsSite.id'));
     $this->assertEquals($expected, $result);
 }
開發者ID:agashish,項目名稱:test_new,代碼行數:19,代碼來源:ModelIntegrationTest.php

示例15: createSite

 protected function createSite(\User $user)
 {
     $model = new \Site(['name' => 'Test', 'description' => '', 'email' => $user->email, 'lang' => 'en-US', 'create_lrs' => 'super', 'registration' => 'Closed', 'restrict' => 'None', 'domain' => '', 'super' => [['user' => new \MongoId($user->_id)]]]);
     $success = $model->save();
     return $model;
 }
開發者ID:scmc,項目名稱:learninglocker,代碼行數:6,代碼來源:InstanceTestCase.php


注:本文中的Site::save方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。