本文整理汇总了PHP中Documents::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Documents::model方法的具体用法?PHP Documents::model怎么用?PHP Documents::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Documents
的用法示例。
在下文中一共展示了Documents::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
/**
* Lists all models.
*/
public function actionIndex()
{
if (isset($_POST['oper']) && $_POST['oper'] == 'edit') {
$documentId = intval($_POST["id"]);
$document = Documents::model()->with('images', 'user')->findByPk($documentId);
if ($document) {
$user = $document->user;
$image = $document->image;
if ($user) {
$person = $user->person;
$addresses = $person->adresses;
if (isset($addresses[0])) {
$address = $addresses[0];
$address->Address1 = $_POST["Address1"];
$address->Address2 = $_POST["Address2"];
$address->City = $_POST["City"];
$address->State = $_POST["State"];
$address->ZIP = $_POST["ZIP"];
$address->Country = $_POST["Country"];
$address->Phone = $_POST["Phone"];
$address->Fax = $_POST["Fax"];
if ($address->validate()) {
$address->save();
echo "adresses\n";
}
}
$user->User_Login = $_POST["User_Login"];
$user->User_Type = $_POST["User_Type"];
$user->Last_Login = $_POST["Last_Login"] ? $_POST["Last_Login"] : null;
$user->Active = intval($_POST["Active"]);
if ($user->validate()) {
$user->save();
echo "user\n";
}
$person->First_Name = $_POST["First_Name"];
$person->Last_Name = $_POST["Last_Name"];
$person->Email = $_POST["Email"];
$person->Mobile_Phone = $_POST["Mobile_Phone"];
$person->Direct_Phone = $_POST["Direct_Phone"];
$person->Direct_Fax = $_POST["Direct_Fax"];
if ($person->validate()) {
$person->save();
echo "person\n";
}
}
$document->Created = $_POST["Created"];
if ($document->validate()) {
$document->save();
echo "document\n";
}
/*
$image->File_Name = $_POST["File_Name"];
if ($image->validate()) {
$image->save();
echo "image\n";
}
*/
}
die;
}
if (isset($_POST['oper']) && $_POST['oper'] == 'add') {
die;
}
if (isset($_POST['oper']) && $_POST['oper'] == 'del') {
$documentId = intval($_POST["id"]);
$document = Documents::model()->findByPk($documentId);
if ($document) {
Documents::deleteDocument($documentId);
}
die;
}
$conn = mysql_connect(Yii::app()->params->dbhost, Yii::app()->params->dbuser, Yii::app()->params->dbpassword);
mysql_select_db(Yii::app()->params->dbname);
mysql_query("SET NAMES 'utf8'");
Yii::import('ext.phpgrid.inc.jqgrid');
// set columns
$col = array();
$col["title"] = "Document ID"; // caption of column
$col["name"] = "Document_ID";
$col["dbname"] = "documents.Document_ID"; // grid column name, same as db field or alias from sql
$col["resizable"] = false;
$col["editable"] = false; // this column is editable
$col["hidden"] = false;
$col["viewable"] = true;
$col["search"] = false;
//.........这里部分代码省略.........
示例2: FindLocalPersonByDoc
protected function FindLocalPersonByDoc($seria, $number)
{
$c = new CDbCriteria();
if (!(trim($seria) === "")) {
$c->compare("Series", trim($seria));
}
if (!(trim($number) === "")) {
$c->compare("Numbers", trim($number));
}
$models = Documents::model()->findAll($c);
if (!is_array($models) && is_object($models)) {
return $models->PersonID;
}
foreach ($models as $obj) {
return $obj->PersonID;
if ($obj->TypeID == 2) {
return $obj->PersonID;
}
if ($obj->TypeID == 3) {
return $obj->PersonID;
}
if ($obj->TypeID == 4) {
return $obj->PersonID;
}
}
return 0;
}
示例3: loadDocumentsModel
public function loadDocumentsModel($id)
{
$model = Documents::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
示例4: run
/**
public function run()
{
// list of valid extensions, ex. array("jpeg", "xml", "bmp")
$allowedExtensions = array("jpg");
// max file size in bytes
$sizeLimit = 1 * 1024 * 1024;
$uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
$result = $uploader->handleUpload('upload/');
// to pass data through iframe you will need to encode all html tags
$result=htmlspecialchars(json_encode($result), ENT_NOQUOTES);
echo $result;
}
**/
public function run()
{
$folder = Documents::model()->getTempFolderPath();
$allowedExtensions = array("jpg", "png");
//array("jpg","jpeg","gif","exe","mov" and etc...
$sizeLimit = 5 * 1024 * 1024;
// maximum file size in bytes
// perform upload
$uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
$result = $uploader->handleUpload($folder);
$return = htmlspecialchars(json_encode($result), ENT_NOQUOTES);
$fileSize = filesize($folder . $result['filename']);
//GETTING FILE SIZE
$fileName = $result['filename'];
//GETTING FILE NAME
echo $return;
// it's array
}
示例5: ZNODropDown
public static function ZNODropDown($PersonID, $SepcialityID = 0, $Level = 0)
{
$res = array("" => "");
$model = Documents::model()->findAll("PersonID = :PersonID and TypeID = 4", array(":PersonID" => $PersonID));
if ($SepcialityID != 0) {
$ssubj = Specialitysubjects::model()->findAll("SpecialityID=:SpecialityID and LevelID = :LevelID", array(":SpecialityID" => $SepcialityID, ":LevelID" => $Level));
//debug(print_r($ssubj,true));
if (!empty($model)) {
foreach ($model as $zno) {
//$res[$zno->idDocuments] = $zno->Numbers;
if (!empty($zno->subjects)) {
foreach ($zno->subjects as $subject) {
if (!empty($ssubj)) {
//debug('$ssubj->SubjectID='.$ssubj->SubjectID);
foreach ($ssubj as $rec) {
if ($subject->subject->idSubjects == $rec->SubjectID) {
//debug('$ssubj->SubjectID='.$ssubj->SubjectID);
$res[$subject->idDocumentSubject] = $subject->subject->SubjectName . ": " . $subject->SubjectValue . " (№" . $zno->Numbers . " от " . $subject->DateGet . ", пін: " . $zno->ZNOPin . ")";
}
}
} else {
$res[$subject->idDocumentSubject] = $subject->subject->SubjectName . ": " . $subject->SubjectValue . " (№" . $zno->Numbers . " от " . $subject->DateGet . ", пін: " . $zno->ZNOPin . ")";
}
}
}
}
}
} else {
if (!empty($model)) {
foreach ($model as $zno) {
//$res[$zno->idDocuments] = $zno->Numbers;
if (!empty($zno->subjects)) {
foreach ($zno->subjects as $subject) {
$res[$subject->idDocumentSubject] = $subject->subject->SubjectName . ": " . $subject->SubjectValue . " (№" . $zno->Numbers . " от " . $subject->DateGet . ", пін: " . $zno->ZNOPin . ")";
}
}
}
}
}
if (count($res) == 2) {
unset($res[""]);
}
return $res;
}
示例6: DropDownMask
/**
* DropDownMask
* @param type $FacultetID
* @param type $EducationFormID
* @param type $QualificationID
* @param type $BaseSpecID
* @return string
*/
public static function DropDownMask($FacultetID = 0, $EducationFormID = 0, $QualificationID = 0, $BaseSpecID = 0)
{
$user = Yii::app()->user->getUserModel();
$records = array();
$res = array();
$mask = "";
if ($QualificationID == 3) {
$mask = "7";
}
if ($QualificationID == 2) {
$mask = "8";
}
if ($QualificationID == 1) {
$mask = "6";
}
if ($FacultetID == 0 || $EducationFormID == 0 || $QualificationID == 0) {
//$records = Specialities::model()->findAll("SpecialityClasifierCode like '7%' or SpecialityClasifierCode like '8%'");
} else {
$records = Specialities::model()->findAll("FacultetID = :FacultetID and PersonEducationFormID = :EducationFormID and SpecialityClasifierCode like '{$mask}%'", array(":FacultetID" => $FacultetID, ":EducationFormID" => $EducationFormID));
}
$bs = array();
if ($BaseSpecID > 0) {
$doc = Documents::model()->findByPk($BaseSpecID);
if (!empty($doc->PersonBaseSpecealityID)) {
$rel = BasespecialityRelation::model()->findAll("PersonBaseSpecialityID = {$doc->PersonBaseSpecealityID}");
foreach ($rel as $item) {
$bs[] = $item->SpecialityID;
}
}
}
//Yii::log(print_r($BaseSpecID,1));
//Yii::log(print_r($bs,1));
foreach ($records as $record) {
if (!empty($bs)) {
if (in_array($record->idSpeciality, $bs)) {
$res[$record->idSpeciality] = (!empty($record->SpecialityName) ? $record->SpecialityName . " " : "") . $record->SpecialityDirectionName . (!empty($record->SpecialitySpecializationName) ? ": " . $record->SpecialitySpecializationName . " " : "") . "(" . $record->SpecialityClasifierCode . ")";
if (!empty($record->PersonEducationFormID)) {
switch ($record->PersonEducationFormID) {
case "1":
$res[$record->idSpeciality] .= "(Д)";
break;
case "2":
$res[$record->idSpeciality] .= "(З)";
break;
case "3":
$res[$record->idSpeciality] .= "(Е)";
break;
}
}
}
} else {
$res[$record->idSpeciality] = (!empty($record->SpecialityName) ? $record->SpecialityName . " " : "") . $record->SpecialityDirectionName . (!empty($record->SpecialitySpecializationName) ? ": " . $record->SpecialitySpecializationName . " " : "") . "(" . $record->SpecialityClasifierCode . ")";
if (!empty($record->PersonEducationFormID)) {
switch ($record->PersonEducationFormID) {
case "1":
$res[$record->idSpeciality] .= "(Д)";
break;
case "2":
$res[$record->idSpeciality] .= "(З)";
break;
case "3":
$res[$record->idSpeciality] .= "(Е)";
break;
}
}
}
}
//Yii::log(print_r($res, 1));
return $res;
}
示例7: findAttachments
public function findAttachments($comment_id)
{
return Documents::model()->findAll(array('condition' => 't.comment_id = :comment_id', 'params' => array('comment_id' => $comment_id), 'order' => 't.document_id'));
}
示例8: appendPosList
public function appendPosList ($client_id,$project_list,$doc_type){
$condition = new CDbCriteria();
$condition->condition =' documents.Client_ID = '.$client_id;
$condition->addInCondition('documents.Project_ID ',$project_list);
$condition->join = 'left join documents on documents.Document_ID = t.Document_ID';
$models = Pos::model()->with('document')->findAll($condition);
$xml_doc = $this->xml->createElement("document");
if($models) {
foreach ($models as $model) {
$xml_row = $this->xml->createElement("row");
foreach ($model->attributes as $key => $value) {
$xml_field = $this->xml->createElement("field",htmlentities($value,ENT_QUOTES | 'ENT_XML1'));
$xml_field->setAttribute('name', $key);
$xml_row->appendChild($xml_field);
}
//+ we need to insert several columns from document model
$xml_field = $this->xml->createElement("field",htmlentities($model->document->Origin,ENT_QUOTES | 'ENT_XML1'));
$xml_field->setAttribute('name', 'DocumentsOrigin');
$xml_row->appendChild($xml_field);
$xml_field = $this->xml->createElement("field",htmlentities($model->document->Created,ENT_QUOTES | 'ENT_XML1'));
$xml_field->setAttribute('name', 'DocumentsCreated');
$xml_row->appendChild($xml_field);
$xml_field = $this->xml->createElement("field",htmlentities($model->document->Project_ID,ENT_QUOTES | 'ENT_XML1'));
$xml_field->setAttribute('name', 'DocumentsProject_ID');
$xml_row->appendChild($xml_field);
// end of block
/*documents processing*/
$xml_doc_row = $this->xml->createElement("documents");
foreach ($model->document->attributes as $key => $value) {
$xml_field = $this->xml->createElement("field",htmlentities($value,ENT_QUOTES | 'ENT_XML1'));
$xml_field->setAttribute('name', $key);
$xml_doc_row->appendChild($xml_field);
}
/*end of documents processing*/
/*bacups processing*/
$bacup = Documents::model()->findByPk($model->PO_Backup_Document_ID);
$xml_backup_row = $this->xml->createElement("backup");
if ($bacup){
foreach ($bacup->attributes as $key => $value) {
$xml_field = $this->xml->createElement("field",htmlentities($value,ENT_QUOTES | 'ENT_XML1'));
$xml_field->setAttribute('name', $key);
$xml_backup_row->appendChild($xml_field);
}
}
/*end of bacups processing*/
/*po descriptions connected processing*/
$xml_desc = $this->xml->createElement("po_desc_detail");
foreach ($model->decr_details as $descs) {
$xml_dist_row = $this->xml->createElement("desc_row");
foreach ($descs as $key=>$value) {
$xml_field = $this->xml->createElement("field",htmlentities($value,ENT_QUOTES | 'ENT_XML1'));
$xml_field->setAttribute('name', $key);
$xml_dist_row->appendChild($xml_field);
}
$xml_desc->appendChild($xml_dist_row);
/*end of descriptions processing*/
/*dists processing*/
$xml_dists = $this->xml->createElement("po_dists");
foreach ($model->dists as $dist) {
$xml_dist_row = $this->xml->createElement("dist_row");
foreach ($dist as $key=>$value) {
$xml_field = $this->xml->createElement("field",htmlentities($value,ENT_QUOTES | 'ENT_XML1'));
$xml_field->setAttribute('name', $key);
$xml_dist_row->appendChild($xml_field);
}
$xml_dists->appendChild($xml_dist_row);
}
/*end of dists processing*/
/*images processing*/
$xml_image_row = $this->xml->createElement("images");
$xml_field = $this->xml->createElement("field",$model->document->image->Image_ID);
$xml_field->setAttribute('name', 'Image_ID');
$xml_image_row->appendChild($xml_field);
$filename = FileModification::prepareFileForExport($model->document->image->Document_ID,$doc_type,$this->filepath);
$xml_field = $this->xml->createElement("field",$filename);
$xml_field->setAttribute('name', 'File_Name');
$xml_image_row->appendChild($xml_field);
$xml_row->appendChild($xml_field);
$xml_field = $this->xml->createElement("field",$model->document->image->Mime_Type);
//.........这里部分代码省略.........
示例9: getDocuments
/**
* Get all documents related to selected project
* By default project_id is selected
* @return model list of documents
*/
public function getDocuments()
{
return Documents::model()->findDocuments(Yii::app()->user->getState('project_selected'));
}
示例10: intval
<?php
/**
* Created by PhpStorm.
* User: lee
* Date: 9/18/14
* Time: 1:02 PM
*/
echo '<div style="margin-left: 100px;width: 200px;">';
if($docId) {
$id = intval($docId);
$str=0;
//check if current document can be deleted or replaced
$doc_to_modify = Documents::model()->findByPk($id);
$can_be_changed = false;
if (
//1
(Documents::hasAccess($id) && Documents::hasDeletePermission($id, $doc_to_modify->Document_Type, Yii::app()->user->userID, Yii::app()->user->clientID))
||
//2
(Yii::app()->user->userType == UsersClientList::APPROVER)
)
{
$can_be_changed = true;
}
} else if ($file_name) {
$id=$file_name;
$str=1;
} else if ($imgId) {
示例11: actionEditZno
public function actionEditZno($documentid)
{
$model = Documents::model()->findByPk($documentid);
if (empty($model)) {
throw new Exception("Документ (id = {$documentid}) не знайдено!");
}
$model->scenario = "ZNO";
$personid = $model->PersonID;
$this->renderPartial('_znoModal', array('model' => $model, 'subjects' => $model->subjects, 'personid' => $personid, true, true));
}
示例12: array
<?php
/* @var $this DocumentsController */
/* @var $dataProvider CActiveDataProvider */
$this->breadcrumbs = array('Documents');
$this->menu = array(array('label' => 'Create Documents', 'url' => array('create')), array('label' => 'Manage Documents', 'url' => array('admin')));
$atts = Documents::model();
?>
<h1>Заявки</h1>
<a href="<?php
echo Yii::app()->createUrl('documents/create');
?>
" class="btn btn-primary btn-lg">Добавить заявку</a>
<br>
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<div class="box-name">
<span>Список заявок</span>
</div>
<div class="box-icons">
<a class="collapse-link">
<i class="fa fa-chevron-up"></i>
</a>
<a class="expand-link">
<i class="fa fa-expand"></i>
</a>
</div>
示例13: CalculatePages
public static function CalculatePages($origing,$cli_id) {
set_time_limit(200);
$sum = 0;
$condition = new CDbCriteria();
if ($origing != '') $condition->condition = "Origin='" . $origing . "'";
$condition->addCondition("Client_ID = '" . $cli_id . "'");
$documents = Documents::model()->findAll($condition);
require_once(Yii::app()->basePath.'/extensions/Fpdf/fpdf.php');
require_once(Yii::app()->basePath.'/extensions/Fpdi/fpdi.php');
foreach($documents as $document) {
$pages = FileModification::calculatePagesByDocID($document->Document_ID);
if ($pages > 1)
{
$image = Images::model()->findByAttributes(array(
'Document_ID'=>$document->Document_ID
));
if ($image ) {
$image->Pages_Count = $pages;
$image->save();
}
}
$sum += $pages;
}
return $sum;
}
示例14: loadRequestFromJsqon
public function loadRequestFromJsqon($jsondata, $sbj)
{
$data = CJSON::decode($jsondata);
if (empty($data)) {
throw new Exception("Заявку не знайдено!");
}
$data = (object) $data[0];
$this->RequestFromEB = 1;
$this->edboID = $data->idPersonRequest;
$this->isBudget = $data->isBudget;
$this->isContract = $data->isContract;
$this->isNeedHostel = $data->isNeedHostel;
$this->StatusID = $data->idPersonRequestStatusType;
Yii::log($this->StatusID);
$doc = Documents::model()->find("edboID=" . $data->idPersonDocument);
if (empty($doc)) {
throw new Exception("Документ для вступу відсутный або не синхронізований!");
}
$this->EntrantDocumentID = $doc->idDocuments;
$this->EducationFormID = $data->idPersonEducationForm;
$this->QualificationID = $data->idQualification;
$spec = Specialities::model()->find("SpecialityKode = '" . $data->universitySpecialitiesKode . "'");
if (empty($spec)) {
throw new Exception("Пропозиція відсутня");
//$this->SepcialityID = 153677;
} else {
$this->SepcialityID = $spec->idSpeciality;
}
Yii::log($this->SepcialityID);
$this->LanguageExID = $data->idLanguageEx;
$this->EntranceTypeID = $data->idPersonEnteranceTypes;
$this->CausalityID = $data->idPersonRequestExaminationCause;
$this->SkipDocumentValue = $data->skipDocumentValue;
$this->priority = $data->requestPriority;
// Load subjects
$sdata = CJSON::decode($sbj);
if (empty($data)) {
throw new Exception("Не задано передмети!");
}
if (!empty($sdata[0])) {
$s1 = (object) $sdata[0];
$doc = Documents::model()->find("edboID=" . $s1->idPersonDocument);
$subj1 = Documentsubject::model()->find("DocumentID = {$doc->idDocuments} and SubjectID = {$s1->idSubject}");
$this->DocumentSubject1 = $subj1->idDocumentSubject;
}
if (!empty($sdata[1])) {
$s1 = (object) $sdata[1];
$doc = Documents::model()->find("edboID=" . $s1->idPersonDocument);
$subj1 = Documentsubject::model()->find("DocumentID = {$doc->idDocuments} and SubjectID = {$s1->idSubject}");
$this->DocumentSubject2 = $subj1->idDocumentSubject;
}
if (!empty($sdata[2])) {
$s1 = (object) $sdata[2];
$doc = Documents::model()->find("edboID=" . $s1->idPersonDocument);
$subj1 = Documentsubject::model()->find("DocumentID = {$doc->idDocuments} and SubjectID = {$s1->idSubject}");
$this->DocumentSubject3 = $subj1->idDocumentSubject;
}
Yii::log(print_r($this->DocumentSubject1 . " " . $this->DocumentSubject2 . " " . $this->DocumentSubject3, 1));
}
示例15: getPaymentInvoices
/**
* Get related Payment's APs
* @param $payment
* @param $invoiceNumber
* @return Aps|null
*/
public static function getPaymentInvoices($payment, $invoiceNumber)
{
$document = Documents::model()->findByPk($payment->Document_ID);
$condition = new CDbCriteria();
$condition->join = "LEFT JOIN documents ON documents.Document_ID = t.Document_ID";
$condition->condition = "t.Vendor_ID=:vendorID";
$condition->addCondition("t.Invoice_Number=:invoice_Number");
$condition->addCondition("documents.Project_ID = '" . $document->Project_ID . "'");
$condition->params = array(
':vendorID' => $payment->Vendor_ID,
':invoice_Number' => $invoiceNumber,
);
$ap = Aps::model()->findAll($condition);
return $ap;
}