当前位置: 首页>>代码示例>>PHP>>正文


PHP Documents::hasAccess方法代码示例

本文整理汇总了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;
开发者ID:ranvijayj,项目名称:htmlasa,代码行数:31,代码来源:buttons.php

示例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);
    }
开发者ID:ranvijayj,项目名称:htmlasa,代码行数:57,代码来源:FileController.php

示例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;
            }
        }
    }
开发者ID:ranvijayj,项目名称:htmlasa,代码行数:33,代码来源:PcController.php


注:本文中的Documents::hasAccess方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。