当前位置: 首页>>代码示例>>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;未经允许,请勿转载。