當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Documents::deleteDocument方法代碼示例

本文整理匯總了PHP中Documents::deleteDocument方法的典型用法代碼示例。如果您正苦於以下問題:PHP Documents::deleteDocument方法的具體用法?PHP Documents::deleteDocument怎麽用?PHP Documents::deleteDocument使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Documents的用法示例。


在下文中一共展示了Documents::deleteDocument方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
//.........這裏部分代碼省略.........
開發者ID:ranvijayj,項目名稱:htmlasa,代碼行數:101,代碼來源:DocumentsController.php

示例2: __construct

 /**
  * [__construct description]
  * Stellt entsprechend der Anfrage das Dokument dar
  */
 public function __construct()
 {
     $doc = new Documents();
     // Neues Dokument erstellen
     if (isset($_POST["operation"])) {
         if ($_POST["operation"] == "create") {
             $current_user = wp_get_current_user();
             $doc->createNewDocument($this->saveInputs($_POST["project_name"]), $current_user->display_name, get_current_user_id(), $this->saveInputs($_POST["layout"]));
         } else {
             if ($_POST["operation"] == "delete") {
                 $doc->deleteDocument($this->saveInputs($_POST["id"]));
             } else {
                 if ($_POST["operation"] == "selectGroup") {
                     $group = new Groups();
                     $group->selectGroup($this->saveInputs($_POST["selectedGroup"]), $this->saveInputs($_POST["document_id"]));
                 } else {
                     if ($_POST["operation"] == "addAbschnitt") {
                         $doc->addAbschnitt(esc_textarea($_POST["content"]), $this->saveInputs($_POST["document_id"]));
                     } else {
                         if ($_POST["operation"] == "setContentAbschnitt") {
                             $doc->updateAbschnitt($this->saveInputs($_POST["document_id"]), $this->saveInputs($_POST["abschnitt_id"]), esc_textarea($_POST["content"]));
                         } else {
                             if ($_POST["operation"] == "deleteAbschnitt") {
                                 $doc->deleteAbschnitt($this->saveInputs($_POST["document_id"]), $this->saveInputs($_POST["abschnitt_id"]));
                             } else {
                                 if ($_POST["operation"] == "selectLayout") {
                                     $doc->selectLayout($this->saveInputs($_POST["document_id"]), $this->saveInputs($_POST["selectedLayout"]), $this->saveInputs($_POST["old_layout"]));
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if (isset($_GET["id"])) {
         $document = $doc->getDocument($this->saveInputs($_GET["id"]));
         $document->abschnitte = array();
         $document->abschnitte = $doc->getAbschnitte($document->id);
         $downloadLinks = $doc->getDownloadLinks($document);
         $document->downloadZip = $downloadLinks["zip"];
         $document->downloadPdf = $downloadLinks["pdf"];
         $this->viewDocument($document);
     } else {
         if (isset($_GET["create"])) {
             $this->viewDocumentCreateForm($_GET["create"]);
         } else {
             $authDocs = $doc->getDocumentsCreatedByUser(get_current_user_id());
             $this->viewShortDoc($authDocs);
             $this->viewDocumentCreateForm();
         }
     }
 }
開發者ID:JanUrb,項目名稱:Web-SystemeFL-WP,代碼行數:57,代碼來源:DokumentView.php


注:本文中的Documents::deleteDocument方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。