本文整理汇总了PHP中Documents::hasAccess方法的典型用法代码示例。如果您正苦于以下问题:PHP Documents::hasAccess方法的具体用法?PHP Documents::hasAccess怎么用?PHP Documents::hasAccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Documents
的用法示例。
在下文中一共展示了Documents::hasAccess方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: intval
* 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) {
$id= $imgId;
$str=0;
示例2: actionRotate
public function actionRotate(){
$result['success'] = false;
if(Yii::app()->request->isAjaxRequest && $_POST['docID']){
// start profiling
//xhprof_enable(XHPROF_FLAGS_MEMORY);
$doc_id= intval($_POST['docID']);
$rotate_direction=strval ($_POST['action']);
if ($doc_id > 0 && Documents::hasAccess($doc_id)) {
$return_array=FileModification::prepareFile($doc_id);
if($return_array['ext']!='pdf'){
$return_array = FileModification::ImageToPdf($return_array['path_to_dir'],$return_array['filename'],$return_array['ext']);
}
if(!$result['error']) {
$result=FileModification::rotateFile($return_array['path_to_dir'],$return_array['filename'],$rotate_direction);
$result['success'] = true;
} else {
$result['success'] = false;
$result['error_message'] = "File was not rendered.";
}
if(!$result['error']) {
$return_array = FileModification::writeToBase($return_array['path_to_dir'],$return_array['filename'],'application/pdf',$doc_id);
$result['file_id'] = FileCache::updateFileInCache($doc_id);
$result['success'] = true;
} else {
$result['success'] = false;
$result['error_message'] = "File was not rendered.";
}
}
// stop profiler
/* $xhprof_data = xhprof_disable();
include_once "/usr/share/php/xhprof_lib/utils/xhprof_lib.php";
include_once "/usr/share/php/xhprof_lib/utils/xhprof_runs.php";
$xhprof_runs = new XHProfRuns_Default();
$run_id = $xhprof_runs->save_run($xhprof_data, "filemodification");
*/
}
echo CJSON::encode($result);
}
示例3: actionSendDocumentByEmail
/**
* Send document by email action
*/
public function actionSendDocumentByEmail()
{
if (Yii::app()->request->isAjaxRequest && isset($_POST['email']) && isset($_POST['docId'])) {
$docId = intval($_POST['docId']);
$email = trim($_POST['email']);
if ($docId > 0 && $email != '' && Documents::hasAccess($docId)) {
$document = Documents::model()->findByPk($docId);
$condition = new CDbCriteria();
$condition->condition = "Document_ID='" . $document->Document_ID . "'";
$file = Images::model()->find($condition);
$pc = Pcs::model()->with('document')->findByAttributes(array(
'Document_ID' => $docId,
));
$filePath = 'protected/data/docs_to_email/' . $file->File_Name;
file_put_contents($filePath, stripslashes($file->Img));
//send document
Mail::sendDocument($email, $file->File_Name, $filePath, $pc->Employee_Name);
//delete file
unlink($filePath);
echo 1;
} else {
echo 0;
}
}
}