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


PHP Attachments::delete方法代码示例

本文整理汇总了PHP中Attachments::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Attachments::delete方法的具体用法?PHP Attachments::delete怎么用?PHP Attachments::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Attachments的用法示例。


在下文中一共展示了Attachments::delete方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: deleteAttachment

 public function deleteAttachment(Attachments $attachment)
 {
     /** @var myModel $this */
     $attachment->delete();
     $this->decreaseCount('attachmentCount');
     return $this;
 }
开发者ID:huoybb,项目名称:standard,代码行数:7,代码来源:attachableTrait.php

示例2: delete

 /**
  * Removes a candidate and all associated records from the system.
  *
  * @param integer Candidate ID to delete.
  * @return void
  */
 public function delete($candidateID)
 {
     /* Delete the candidate from candidate. */
     $sql = sprintf("DELETE FROM\n                candidate\n            WHERE\n                candidate_id = %s\n            AND\n                site_id = %s", $this->_db->makeQueryInteger($candidateID), $this->_siteID);
     $this->_db->query($sql);
     $history = new History($this->_siteID);
     $history->storeHistoryDeleted(DATA_ITEM_CANDIDATE, $candidateID);
     /* Delete pipeline entries from candidate_joborder. */
     $sql = sprintf("DELETE FROM\n                candidate_joborder\n            WHERE\n                candidate_id = %s\n            AND\n                site_id = %s", $this->_db->makeQueryInteger($candidateID), $this->_siteID);
     $this->_db->query($sql);
     /* Delete pipeline history from candidate_joborder_status_history. */
     $sql = sprintf("DELETE FROM\n                candidate_joborder_status_history\n            WHERE\n                candidate_id = %s\n            AND\n                site_id = %s", $this->_db->makeQueryInteger($candidateID), $this->_siteID);
     $this->_db->query($sql);
     /* Delete from saved lists. */
     $sql = sprintf("DELETE FROM\n                saved_list_entry\n            WHERE\n                data_item_id = %s\n            AND\n                site_id = %s\n            AND\n                data_item_type = %s", $this->_db->makeQueryInteger($candidateID), $this->_siteID, DATA_ITEM_CANDIDATE);
     $this->_db->query($sql);
     /* Delete attachments. */
     $attachments = new Attachments($this->_siteID);
     $attachmentsRS = $attachments->getAll(DATA_ITEM_CANDIDATE, $candidateID);
     foreach ($attachmentsRS as $rowNumber => $row) {
         $attachments->delete($row['attachmentID']);
     }
     /* Delete extra fields. */
     $this->extraFields->deleteValueByDataItemID($candidateID);
 }
开发者ID:PublicityPort,项目名称:OpenCATS,代码行数:31,代码来源:Candidates.php

示例3: onDeleteAttachment

 private function onDeleteAttachment()
 {
     if ($this->_accessLevel < ACCESS_LEVEL_DELETE) {
         $this->listByView('Invalid user level for action.');
         return;
     }
     /* Bail out if we don't have a valid attachment ID. */
     if (!$this->isRequiredIDValid('attachmentID', $_GET)) {
         CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid attachment ID.');
     }
     /* Bail out if we don't have a valid joborder ID. */
     if (!$this->isRequiredIDValid('companyID', $_GET)) {
         CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid company ID.');
     }
     $companyID = $_GET['companyID'];
     $attachmentID = $_GET['attachmentID'];
     if (!eval(Hooks::get('CLIENTS_ON_DELETE_ATTACHMENT_PRE'))) {
         return;
     }
     $attachments = new Attachments($this->_siteID);
     $attachments->delete($attachmentID);
     if (!eval(Hooks::get('CLIENTS_ON_DELETE_ATTACHMENT_POST'))) {
         return;
     }
     CATSUtility::transferRelativeURI('m=companies&a=show&companyID=' . $companyID);
 }
开发者ID:rankinp,项目名称:OpenCATS,代码行数:26,代码来源:CompaniesUI.php

示例4: deleteBulkResumes

 private function deleteBulkResumes()
 {
     if (!isset($_SESSION['CATS']) || empty($_SESSION['CATS'])) {
         CommonErrors::fatal(COMMONERROR_NOTLOGGEDIN, $this);
     }
     if ($_SESSION['CATS']->getAccessLevel() < ACCESS_LEVEL_SA) {
         CommonErrors::fatal(COMMONERROR_PERMISSION, $this);
     }
     $uploadPath = FileUtility::getUploadPath($this->_siteID, 'massimport');
     $attachments = new Attachments($this->_siteID);
     $bulkResumes = $attachments->getBulkAttachments();
     if (!count($bulkResumes)) {
         CommonErrors::fatal(COMMONERROR_BADINDEX, $this);
     }
     /**
      * Write the parsed resume contents to the new file which will
      * be created as a text document for each bulk attachment.
      */
     foreach ($bulkResumes as $bulkResume) {
         $attachments->delete($bulkResume['attachmentID'], true);
     }
     $this->import();
 }
开发者ID:PublicityPort,项目名称:OpenCATS,代码行数:23,代码来源:ImportUI.php

示例5: delete

 /**
  * Removes a company and all associated records from the system.
  *
  * @param integer Company ID
  * @return void
  */
 public function delete($companyID)
 {
     /* Delete the company. */
     $sql = sprintf("DELETE FROM\n                company\n            WHERE\n                company_id = %s\n            AND\n                site_id = %s", $companyID, $this->_siteID);
     $this->_db->query($sql);
     $history = new History($this->_siteID);
     $history->storeHistoryDeleted(DATA_ITEM_COMPANY, $companyID);
     /* Find associated contacts. */
     $sql = sprintf("SELECT\n                contact_id AS contactID\n            FROM\n                contact\n            WHERE\n                company_id = %s\n            AND\n                site_id = %s", $companyID, $this->_siteID);
     $contactsRS = $this->_db->getAllAssoc($sql);
     /* Find associated job orders. */
     $sql = sprintf("SELECT\n                joborder_id AS jobOrderID\n            FROM\n                joborder\n            WHERE\n                company_id = %s\n            AND\n                site_id = %s", $companyID, $this->_siteID);
     $jobOrdersRS = $this->_db->getAllAssoc($sql);
     /* Find associated attachments. */
     $attachments = new Attachments($this->_siteID);
     $attachmentsRS = $attachments->getAll(DATA_ITEM_COMPANY, $companyID);
     /* Delete associated contacts. */
     $contacts = new Contacts($this->_siteID);
     foreach ($contactsRS as $rowIndex => $row) {
         $contacts->delete($row['contactID']);
     }
     /* Delete associated job orders. */
     $jobOrders = new JobOrders($this->_siteID);
     foreach ($jobOrdersRS as $rowIndex => $row) {
         $jobOrders->delete($row['jobOrderID']);
     }
     /* Delete associated attachments. */
     foreach ($attachmentsRS as $rowNumber => $row) {
         $attachments->delete($row['attachmentID']);
     }
     /* Delete from saved lists. */
     $sql = sprintf("DELETE FROM\n                saved_list_entry\n            WHERE\n                data_item_id = %s\n            AND\n                site_id = %s\n            AND\n                data_item_type = %s", $this->_db->makeQueryInteger($companyID), $this->_siteID, DATA_ITEM_COMPANY);
     $this->_db->query($sql);
     /* Delete extra fields. */
     $this->extraFields->deleteValueByDataItemID($companyID);
 }
开发者ID:rankinp,项目名称:OpenCATS,代码行数:42,代码来源:Companies.php

示例6: careersPage


//.........这里部分代码省略.........
                $phoneCell,
                $phoneWork,
                $address,
                $city,
                $state,
                $zip,
                $candidate['source'],
                $keySkills,
                $candidate['dateAvailable'],
                $currentEmployer,
                $candidate['canRelocate'],
                $candidate['currentPay'],
                $candidate['desiredPay'],
                $candidate['notes'],
                $candidate['webSite'],
                $bestTimeToCall,
                $candidate['owner'],
                $candidate['isHot'] ? true : false,
                $email1,
                $email1,
                $candidate['eeoGender'],
                $candidate['eeoEthnicType'],
                $candidate['eeoVeteranType'],
                $candidate['eeoDisabilityStatus']
            );

            $uploadResume = FileUtility::getUploadFileFromPost($siteID, 'careerportaladd', 'file');
            if ($uploadResume !== false)
            {
                $uploadPath = FileUtility::getUploadFilePath($siteID, 'careerportaladd', $uploadResume);
                if ($uploadPath !== false)
                {
                    // Replace most current resume with new uploaded resume
                    $attachmentsLib->delete($attachmentID, true);
                    $attachmentCreator = new AttachmentCreator($siteID);
                    $attachmentCreator->createFromFile(DATA_ITEM_CANDIDATE, $candidate['candidateID'],
                        $uploadPath, false, '', true, true
                    );
                }
            }

            // Set the cookie again, since some information used to verify may be changed
            $storedVal = '';
            foreach ($fieldValues as $tag => $tagData)
            {
                $storedVal .= sprintf('"%s"="%s"', urlencode($tag), urlencode($tagData));
            }
            @setcookie($this->getCareerPortalCookieName($siteID), $storedVal, time()+60*60*24*7*2);

            $template['Content'] = '<div id="careerContent"><br /><br /><h1>Please wait while you are redirected to your updated profile...</h1></div>';
            CATSUtility::transferRelativeURI('m=careers&p=showAll&pa=updateProfile&isPostBack=yes');
        }
        else if ($p == 'candidateRegistration' && $isRegistrationEnabled)
        {
            /*$content = $template['Content - Candidate Registration'];

            $jobID = intval($_GET['ID']);
            $jobOrderData = $jobOrders->get($jobID);
            $js = '';

            $content = str_replace(array('<applyContent>','</applyContent>'), '', $content);

            $content = str_replace('<input-submit>', '<input type="submit" id="submitButton" name="submitButton" value="Continue to Application" />', $content);
            $content = str_replace('<input-new>', '<input type="radio" id="isNewYes" name="isNew" value="yes" onchange="isCandidateRegisteredChange();" checked />', $content);
            $content = str_replace('<input-registered>', '<input type="radio" id="isNewNo" name="isNew" value="no" onchange="isCandidateRegisteredChange();" />', $content);
            $content = str_replace('<input-rememberMe>', '<input type="checkbox" id="rememberMe" name="rememberMe" value="yes" checked />', $content);
开发者ID:Hassanj343,项目名称:candidats,代码行数:67,代码来源:CareersUI.php

示例7: deleteByProjectObjectIds

 /**
  * Delete attachment by project object ID-s
  *
  * @param array $ids
  * @return boolean
  */
 function deleteByProjectObjectIds($ids)
 {
     if (is_foreachable($ids)) {
         $attachments_table = TABLE_PREFIX . 'attachments';
         $project_objects_table = TABLE_PREFIX . 'project_objects';
         $rows = db_execute_all("SELECT {$attachments_table}.id AS 'id' FROM {$attachments_table}, {$project_objects_table} WHERE {$attachments_table}.parent_id = {$project_objects_table}.id AND {$attachments_table}.parent_type = {$project_objects_table}.type AND {$project_objects_table}.id IN (?)", $ids);
         if (is_foreachable($rows)) {
             $attachment_ids = array();
             foreach ($rows as $row) {
                 $attachment_ids[] = (int) $row['id'];
             }
             // if
             return Attachments::delete(array('id IN (?)', $attachment_ids));
         }
         // if
     }
     // if
     return true;
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:25,代码来源:Attachments.class.php

示例8: createGeneric


//.........这里部分代码省略.........
         $fileSize = round(@filesize($tempFilename) / 1024);
         /* The md5sum is stored for duplicate checking. */
         $md5sum = @md5_file($tempFilename);
         /* Check for duplicates. */
         $duplicates = $attachments->getMatching($dataItemType, $dataItemID, $fileSize, $md5sum, $extractedText);
         /* Duplicate attachments are never added, but this is not a fatal
          * error. We will set a property to notify the caller that a
          * duplicate occurred.
          */
         if (!empty($duplicates)) {
             $this->_duplicatesOccurred = true;
             if (file_exists($tempFilename)) {
                 unlink($tempFilename);
             }
             return false;
         }
     } else {
         $fileSize = 0;
         $md5sum = '';
     }
     /* Add the attachment record. At this point, there is no actual
      * associated directory / full file path.
      */
     $attachmentID = $attachments->add($dataItemType, $dataItemID, $attachmentTitle, $originalFilename, $storedFilename, $contentType, $extractText, $extractedText, $isProfileImage, '', $fileSize, $md5sum);
     /* Were we successful? */
     if (!$attachmentID) {
         $this->_isError = true;
         $this->_error = 'Error adding attachment to the database.';
         @unlink($tempFilename);
         return false;
     }
     /* Store the extracted text and attachment ID in properties for later
      * access.
      */
     $this->_extractedText = $extractedText;
     $this->_attachmentID = $attachmentID;
     /* Create the attachment directory. */
     $uniqueDirectory = $this->_createDirectory($attachmentID, $storedFilename);
     if (!$uniqueDirectory) {
         $attachments->delete($attachmentID, false);
         return false;
     }
     /* Create the full path name to the file. */
     $newFileFullPath = $uniqueDirectory . $storedFilename;
     /* Are we creating a new file from file contents, or are we moving a
      * temporary file?
      */
     if ($fileContents !== false) {
         $status = @file_put_contents($newFileFullPath, $fileContents);
         if (!$status) {
             $this->_isError = true;
             $this->_error = sprintf('Cannot create file %s.', $newFileFullPath);
             $attachments->delete($attachmentID, false);
             @unlink($uniqueDirectory);
             return false;
         }
         /* We store file size in KB, rounded to nearest KB. */
         $fileSize = round(@filesize($newFileFullPath) / 1024);
         /* The md5sum is stored for duplicate checking. */
         $md5sum = @md5_file($newFileFullPath);
         /* Check for duplicates. */
         $duplicates = $attachments->getMatching($dataItemType, $dataItemID, $fileSize, $md5sum, $extractedText);
         /* Duplicate attachments are never added, but this is not a fatal
          * error. We will set a property to notify the caller that a
          * duplicate occurred.
          */
         if (!empty($duplicates)) {
             $this->_duplicatesOccurred = true;
             $attachments->delete($attachmentID, false);
             @unlink($newFileFullPath);
             @unlink($uniqueDirectory);
             return false;
         }
     } else {
         if ($fileExists) {
             /* Copy the temp file to the new path. */
             if (!@copy($tempFilename, $newFileFullPath)) {
                 $this->_isError = true;
                 $this->_error = sprintf('Cannot copy temporary file %s to %s.', $tempFilename, $newFileFullPath);
                 $attachments->delete($attachmentID, false);
                 @unlink($newFileFullPath);
                 @unlink($uniqueDirectory);
                 return false;
             }
             /* Try to remove the temp file; if it fails it doesn't matter. */
             @unlink($tempFilename);
         }
     }
     /* Store path to the file (inside the attachments directory) in this
      * object.
      */
     $this->_newFilePath = $newFileFullPath;
     $this->_containingDirectory = $uniqueDirectory;
     /* Update the database with the new directory name. */
     $attachments->setDirectoryName($attachmentID, str_replace('./attachments/', '', $uniqueDirectory));
     if (!eval(Hooks::get('CREATE_ATTACHMENT_FINISHED'))) {
         return;
     }
     return true;
 }
开发者ID:Hassanj343,项目名称:candidats,代码行数:101,代码来源:Attachments.php

示例9: onDeleteAttachment

    public function onDeleteAttachment()
    {
        if ($this->_accessLevel < ACCESS_LEVEL_DELETE)
        {
            CommonErrors::fatal(COMMONERROR_PERMISSION, $this, 'Invalid user level for action.');
        }

        /* Bail out if we don't have a valid attachment ID. */
        if (!$this->isRequiredIDValid('attachmentID', $_GET))
        {
            CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid attachment ID.');
        }

        /* Bail out if we don't have a valid joborder ID. */
        if (!$this->isRequiredIDValid('jobOrderID', $_GET))
        {
            CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid Job Order ID.');
        }

        $jobOrderID  = $_GET['jobOrderID'];
        $attachmentID = $_GET['attachmentID'];

        if (!eval(Hooks::get('JO_ON_DELETE_ATTACHMENT_PRE'))) return;

        $attachments = new Attachments($this->_siteID);
        $attachments->delete($attachmentID);

        if (!eval(Hooks::get('JO_ON_DELETE_ATTACHMENT_POST'))) return;

        CATSUtility::transferRelativeURI(
            'm=joborders&a=show&jobOrderID=' . $jobOrderID
        );
    }
开发者ID:Hassanj343,项目名称:candidats,代码行数:33,代码来源:JobOrdersUI.php


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