本文整理汇总了PHP中Docs::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Docs::save方法的具体用法?PHP Docs::save怎么用?PHP Docs::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Docs
的用法示例。
在下文中一共展示了Docs::save方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionCreatePage
/**
* Create a static page.
*
* This method allows the admin to create a static page to go on the top bar
* menu. The page is a basic doc editor which is then saved as a Module record
* of type "Document."
*/
public function actionCreatePage()
{
$existingDocs = X2Model::model('Docs')->findAll();
$existingDocs = CHtml::listData($existingDocs, 'id', 'name');
$model = new Docs();
$users = User::getNames();
if (isset($_POST['Docs'])) {
$model->attributes = $_POST['Docs'];
$model->createdBy = 'admin';
$model->createDate = time();
$model->lastUpdated = time();
$model->updatedBy = 'admin';
$module = new Modules();
$module->adminOnly = 0;
$module->toggleable = 1;
$module->custom = 1;
$module->visible = 1;
$module->editable = 0;
$module->searchable = 0;
$module->menuPosition = Modules::model()->count();
$module->name = 'document';
$module->title = $model->name;
if ($module->save()) {
if ($model->save()) {
$this->redirect(array('/docs/docs/view', 'id' => $model->id, 'static' => 'true'));
}
}
} else {
if (isset($_POST['existingDoc'])) {
$existingDoc = urldecode($_POST['existingDoc']);
$docRecord = X2Model::model('Docs')->findByAttributes(array('name' => $existingDoc));
if (!is_null($docRecord)) {
$module = new Modules();
$module->adminOnly = 0;
$module->toggleable = 1;
$module->custom = 1;
$module->visible = 1;
$module->editable = 0;
$module->searchable = 0;
$module->menuPosition = Modules::model()->count();
$module->name = 'document';
$module->title = $docRecord->name;
if ($module->save()) {
echo $docRecord->id;
Yii::app()->end();
} else {
$this->refresh();
}
}
}
}
$this->render('createPage', array('model' => $model, 'users' => $users, 'existingDocs' => $existingDocs));
}
示例2: actionCreateQuote
public function actionCreateQuote()
{
$users = User::getNames();
unset($users['Anyone']);
unset($users['admin']);
unset($users[Yii::app()->user->getName()]);
$model = new Docs();
$model->type = 'quote';
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Docs'])) {
$temp = $model->attributes;
$model->attributes = $_POST['Docs'];
$model->visibility = $_POST['Docs']['visibility'];
$model->editPermissions = '';
// $arr=$model->editPermissions;
// if(isset($arr))
// $model->editPermissions=Fields::parseUsers($arr);
$model->createdBy = Yii::app()->user->getName();
$model->createDate = time();
// $changes = $this->calculateChanges($temp,$model->attributes);
// $model = $this->updateChangeLog($model,'Create');
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->id));
}
}
$this->render('create', array('model' => $model, 'users' => null));
}
示例3: actionCreateQuote
public function actionCreateQuote()
{
$model = new Docs();
$model->type = 'quote';
if (isset($_POST['Docs'])) {
$model->setX2Fields($_POST['Docs']);
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->id));
}
}
$this->render('create', array('model' => $model));
}
示例4: readBkmv
public function readBkmv()
{
//sort
$this->sortBkmvFile();
//skip for testing
//
//new company
//get perm from ini
//if (substr($line,395,1)=='2')
// $encoding="ibm862";
//else
$encoding = "windows-1255";
//$encoding="ibm862";
Yii::log('start Openimport', 'info', 'app');
//$bkmv = $yiiBasepath."/files/".$configPath."/openformt/bkmvdata.txt-sorted";
$bkmv = $this->bkmvFile . "-sorted";
$suc = array();
$suc['B110'] = 0;
$suc['A100'] = 0;
$suc['B100'] = 0;
$suc['C100'] = 0;
$suc['M100'] = 0;
$suc['D110'] = 0;
$suc['D120'] = 0;
$suc['Z900'] = 0;
$analze = array();
$analze['B110'] = 0;
$analze['A100'] = 0;
$analze['B100'] = 0;
$analze['C100'] = 0;
$analze['M100'] = 0;
$analze['D110'] = 0;
$analze['D120'] = 0;
$analze['Z900'] = 0;
$accType = 200;
//DELETE FROM `qwe_docCheques` WHERE 1;DELETE FROM `qwe_docDetails` WHERE 1;DELETE FROM `qwe_accounts` WHERE 1;DELETE FROM `qwe_items` WHERE 1;DELETE FROM `qwe_docs` WHERE 1;
if ($fp = fopen($bkmv, 'r')) {
while ($line = fgets($fp)) {
@($line = iconv($encoding, "UTF-8//IGNORE", $line));
//$line=utf8_encode($line);
$type = substr($line, 0, 4);
//$obj=$this->readline($line,$type);
$obj = true;
if (!$obj) {
//$suc[$type]--;
} else {
//foreach ($obj as &$value)
// if ($encoding=="ibm862")
// $value = iconv("ISO-8859-8", "UTF-8", hebrev(iconv("UTF-8", "ISO-8859-8", $value)));
if ($type == 'B110') {
//Acc Haeder
/* Account Import */
$acc = new Accounts();
$acc->readLine($line, $type);
if (isset($this->accTypeIndex[$acc->type])) {
$this->accDesc[$acc->type] = $this->accDesc[$acc->type] . "," . $acc->name;
} else {
$this->accDesc[$acc->type] = $acc->name;
$this->accTypeIndex[$acc->type] = $accType;
$accType++;
}
$acc->type = $this->accTypeIndex[$acc->type];
$acc->save();
//get new acc index save old
unset($acc);
//*/
}
if ($type == 'M100') {
//Item In Stock
$item = new Item();
$item->category_id = 0;
$item->parent_item_id = 0;
$item->isProduct = 0;
$item->profit = 0;
$item->stockType = 0;
$item->readLine($line, $type);
$item->save();
unset($item);
//*/
}
if ($type == 'C100') {
//Doc Haeder
//return "done!";
//Yii::app()->end();
//find type
//global $DocOpenType;
$doc = new Docs();
$doc->readLine($line, $type);
$doc->status = 1;
//needtoChange
//Yii::log($doc,'info','app');
$doc->save();
unset($doc);
/*
if ((isset($DocOpenType[$obj['doctype']])) && (isset($accIndex[$obj['account']]))){
$obj['doctype']=$DocOpenType[$obj['doctype']];
$doc=new document($obj['doctype']);
$stype=$obj['doctype'];
foreach($obj as $key=>$value){
$doc->$key=$value;//print "$key <br />";
//.........这里部分代码省略.........