本文整理汇总了PHP中Module::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Module::save方法的具体用法?PHP Module::save怎么用?PHP Module::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Module
的用法示例。
在下文中一共展示了Module::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCreate
public function testCreate()
{
$model = new Module();
$model->crashreport_id = 1;
$model->name = 'user32.dll';
$model->file_version = '6.1.0.7600';
$model->sym_load_status = 0;
$model->loaded_debug_info_id = null;
$saved = $model->save();
$this->assertTrue($saved);
$model = Module::model()->find('name="user32.dll"');
$this->assertTrue($model != null);
}
示例2: actionCreate
public function actionCreate()
{
$this->actionName = "New Data";
$model = new Module();
if (isset($_POST['Module'])) {
$model->setAttributes($_POST['Module']);
if ($model->save()) {
Yii::app()->user->setFlash('success', "Data saved!");
$this->redirect(array('index'));
}
}
$this->render('create', array('model' => $model));
}
示例3: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Module();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Module'])) {
$model->attributes = $_POST['Module'];
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->name));
}
}
$this->render('create', array('model' => $model));
}
示例4: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate($yearId)
{
$model = new Module();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
$model->academic_year = $yearId;
if (isset($_POST['Module'])) {
$model->attributes = $_POST['Module'];
if ($model->save()) {
$this->redirect(array('academicYear/view', "id" => $yearId));
}
}
$this->render('create', array('model' => $model));
}
示例5: register
public static function register($moduleData)
{
// find module
$module = Module::findFirstByUid($moduleData['uid']);
// if module not found
if (!$module) {
// create module
$module = new Module();
$module->name = $moduleData['name'];
$module->uid = $moduleData['uid'];
$module->publicUrl = $moduleData['publicUrl'];
$module->adminUrl = $moduleData['adminUrl'];
$module->save();
}
}
示例6: save
function save($id = FALSE)
{
if ($_POST) {
if (isset($_POST['listperpage'])) {
foreach ($_POST['listperpage'] as $key => $item) {
if ($item) {
$module = new Module(@$_POST['listid'][$key]);
$module->from_array(array('listperpage' => $item));
$module->save();
}
}
set_notify('success', lang('save_data_complete'));
}
}
redirect('listperpages/admin/listperpages');
}
示例7: add
public function add()
{
if (!$this->securitypolicy->validateAccessRight(6, 'add')) {
$this->load->view('access_denied');
}
$this->load->library('form_validation');
if ($this->form_validation->run() == false) {
$this->load->helper('form');
$this->_viewData['showmsg'] = true;
$this->_viewData['status'] = 'error';
$this->load->view('module_add', $this->_viewData);
} else {
$module = new Module();
$module->setName($this->input->post('module-name'));
$module->setUserId(0);
$module->setDateCreated(date('Y-m-d H:i:s'));
$module->save();
$this->session->set_userdata(array('status' => 'success'));
redirect(site_url('Admin/module_view_main'));
}
}
示例8: detectModules
/**
* detect modules
*
*/
protected function detectModules()
{
$modulePath = Yii::app()->getModulePath();
$modules = array();
$handle = opendir($modulePath);
while (($file = readdir($handle)) !== false) {
if ($file === '.' || $file === '..' || $file === '.svn') {
continue;
}
$path = $modulePath . DIRECTORY_SEPARATOR . $file;
if (is_dir($path)) {
$modules[] = basename($path);
}
}
closedir($handle);
$configChanged = false;
if (count($modules)) {
$enabled = Yii::app()->getModules();
foreach ($modules as $name) {
if (!Module::model()->count('Name=:name', array(':name' => $name))) {
$module = new Module();
$module->Name = $name;
$module->Title = ucfirst($name);
$module->Enabled = array_key_exists($name, $enabled) ? Module::ENABLED_YES : Module::ENABLED_NO;
if ($module->save()) {
$configChanged = true;
} else {
Yii::log('Load Modules error: ' . CVarDumper::dumpAsString($module->getErrors()), CLogger::LEVEL_ERROR, 'application.Cms.controllers.admin.ModulesController');
}
}
}
}
//create config file
if (Yii::app()->hasComponent('config') && (Yii::app()->getComponent('config')->hasConfigFile('modules') === false || $configChanged)) {
$this->initConfigCache();
}
}
示例9: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Module();
$userLevel = UserLevel::model()->findAll();
$preCheckedArray = array();
if (isset($_POST['privilages'])) {
$preCheckedArray = Yii::app()->request->getPost('privilages');
}
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Module'])) {
$model->attributes = $_POST['Module'];
$model->arrPrivilages = Yii::app()->request->getPost('privilages');
if ($model->p_id == 0 || count($model->arrPrivilages)) {
$model->hasPrivilage = true;
}
if ($model->save()) {
Yii::app()->user->setFlash('success', 'Module "' . $model->name . '" saved!');
$model = new Module();
$preCheckedArray = array();
}
}
$this->render('create', array('model' => $model, 'userLevel' => $userLevel, 'preCheckedArray' => $preCheckedArray));
}
示例10: install
/**
* Install a module
*/
public function install($reinstall = false)
{
$isLoaded = app()->getModule($this->getName());
$moduleName = $this->getName();
$module = Module::model()->find('name=:name', array(':name' => $moduleName));
if (!is_object($module)) {
$module = new Module();
$module->name = str_replace('Module', '', get_class($this));
}
$metaData = $this->getMetaData();
$module->attributes = $metaData;
$module->enabled = true;
if (!$isLoaded || $isLoaded && empty($module->id) || $reinstall) {
//Module is not loaded
if (!$module->save()) {
return errorHandler()->getException();
}
if (!$this->checkDependencies() || !$this->checkCompatible()) {
return errorHandler()->getException();
}
if (($step = $this->runInstallScript()) !== true) {
$this->runUninstallScript($step);
return errorHandler()->getException();
}
//activate module
return $this->activate();
} else {
//Module is loaded and stored in db
return true;
}
}
示例11: actionModule
public function actionModule()
{
$model = new Module();
// if the post data is set, the user submitted the form
if ($model->load(Yii::$app->request->post())) {
// in that case, validate the data
if ($model->validate()) {
// save it to the database
$model->save();
return;
}
}
// by default, diplay the form
return $this->render('module', ['model' => $model]);
}
示例12: gen
public function gen()
{
foreach ($this->module as $key => $value) {
$data = new Module();
$data->module = $key;
$data->title = $value;
$data->save();
}
}
示例13: save
/**
* @overrride
* @see Module::save()
*/
public function save()
{
parent::save();
$this->updateSession();
}
示例14: 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 ConnectionInterface $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(ConnectionInterface $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 corresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->aModule !== null) {
if ($this->aModule->isModified() || $this->aModule->isNew()) {
$affectedRows += $this->aModule->save($con);
}
$this->setModule($this->aModule);
}
if ($this->isNew() || $this->isModified()) {
// persist changes
if ($this->isNew()) {
$this->doInsert($con);
} else {
$this->doUpdate($con);
}
$affectedRows += 1;
$this->resetModified();
}
if ($this->customerGroupAclsScheduledForDeletion !== null) {
if (!$this->customerGroupAclsScheduledForDeletion->isEmpty()) {
\CustomerGroupAcl\Model\CustomerGroupAclQuery::create()->filterByPrimaryKeys($this->customerGroupAclsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
$this->customerGroupAclsScheduledForDeletion = null;
}
}
if ($this->collCustomerGroupAcls !== null) {
foreach ($this->collCustomerGroupAcls as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->aclI18nsScheduledForDeletion !== null) {
if (!$this->aclI18nsScheduledForDeletion->isEmpty()) {
\CustomerGroupAcl\Model\AclI18nQuery::create()->filterByPrimaryKeys($this->aclI18nsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
$this->aclI18nsScheduledForDeletion = null;
}
}
if ($this->collAclI18ns !== null) {
foreach ($this->collAclI18ns as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con);
}
}
}
$this->alreadyInSave = false;
}
return $affectedRows;
}
示例15: foreach
</fieldset>
<div class="rowSubmitLeft">
<input name="subbuttom" type="image" src="http://www.squidoo.com/images/btn-save.gif" alt="save" class="button" />
<input name="cancelbutton" type="image" src="http://www.squidoo.com/images/btn-cancel.gif" alt="cancel" class="button" onclick="closeEdit('module1', false); return false;"/>
</div>
</form>
<?php
exit;
break;
case 'save':
//print "<pre>";print_r($_POST);print "</pre>";
foreach ($_POST['modules']['id'] as $key => $val) {
$module->{$key} = $val;
}
if (!$module->save()) {
print $module->file_error;
}
print $module->show();
exit;
break;
}
} else {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Build a Module: Squidoo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="scripts/custom/builder.js"></script>
<script type="text/javascript" src="scripts/custom/display.js"></script>