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


PHP Attachment::getId方法代码示例

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


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

示例1: lookup

 function lookup($var, $tid = 0)
 {
     $id = is_numeric($var) ? $var : self::getIdByFileHash($var, $tid);
     return $id && is_numeric($id) && ($attach = new Attachment($id, $tid)) && $attach->getId() == $id ? $attach : null;
 }
开发者ID:pkdevboxy,项目名称:osTicket-1.7,代码行数:5,代码来源:class.attachment.php

示例2: deleteAttachment

 /**
  * Deletes an attachment
  *
  * @param Issue $issue
  * @param Attachment $attachment
  * @return bool
  * @throws Exception
  * @throws NotAuthorizedException
  * @throws NotFoundException
  * @throws \Exception
  */
 public function deleteAttachment(Issue $issue, Attachment $attachment)
 {
     $issueId = $issue->getId();
     $attachmentId = $attachment->getId();
     $result = $this->request('DELETE', '/issue/' . rawurlencode($issueId) . '/attachment/' . rawurlencode($attachmentId));
     $response = $result['response'];
     if ($response['http_code'] == 200) {
         return true;
     }
     return false;
 }
开发者ID:stingmu,项目名称:youtrack,代码行数:22,代码来源:Connection.php

示例3: switch

 function move_to()
 {
     $gettype = $_GET['gettype'];
     $team_id = $_GET['team_id'];
     $project_id = $_GET['project_id'];
     $ticket_id = $_GET['ticket_id'];
     $move_to_object_id = $_GET['move_to_object_id'];
     if (!empty($gettype)) {
         $this->smarty->assign('gettype', $gettype);
         switch ($gettype) {
             case 'projects':
                 $projects = array();
                 if (!empty($team_id)) {
                     $project_obj = new Project($team_id);
                     //$projects = Milestones::findByProject($project_obj, $this->logged_user);
                     $projects = Milestones::findActiveByProject($project_obj, STATE_VISIBLE, VISIBILITY_NORMAL, 'name', '', '-1');
                 }
                 $this->smarty->assign('projects', $projects);
                 break;
             case 'tickets':
                 $tickets = array();
                 if (!empty($project_id)) {
                     $milestone_obj = new Milestone($project_id);
                     //$tickets = Tickets::findByMilestone($milestone_obj, STATE_VISIBLE, $this->logged_user->getVisibility());
                     $tickets = Tickets::findOpenByMilestone($milestone_obj, STATE_VISIBLE, $this->logged_user->getVisibility());
                 }
                 $this->smarty->assign('tickets', $tickets);
                 break;
             case 'pages':
                 $pages_with_milestone = array();
                 $pages_with_project = array();
                 if (!empty($team_id)) {
                     $project_obj = new Project($team_id);
                     //$pages_with_project = Pages::findByProjectWithoutMilestoneAssociation($project_obj, STATE_VISIBLE, $this->logged_user->getVisibility());
                     $pages_with_project = Pages::findUnarchivedByProjectWithoutMilestoneAssociation($project_obj, STATE_VISIBLE, $this->logged_user->getVisibility());
                 } elseif (!empty($project_id)) {
                     if (!empty($project_id)) {
                         $milestone_obj = new Milestone($project_id);
                         $team_id = $milestone_obj->getProjectId();
                         //$pages_with_milestone = Pages::findByMilestone($milestone_obj, STATE_VISIBLE, $this->logged_user->getVisibility());
                         $pages_with_milestone = Pages::findUnarchivedByMilestone($milestone_obj, STATE_VISIBLE, $this->logged_user->getVisibility());
                         $project_obj = new Project($team_id);
                         //$pages_with_project = Pages::findByProjectWithoutMilestoneAssociation($project_obj, STATE_VISIBLE, $this->logged_user->getVisibility());
                         $pages_with_project = Pages::findUnarchivedByProjectWithoutMilestoneAssociation($project_obj, STATE_VISIBLE, $this->logged_user->getVisibility());
                     }
                 }
                 $this->smarty->assign('pages_with_milestone', $pages_with_milestone);
                 $this->smarty->assign('pages_with_project', $pages_with_project);
                 break;
             case 'action':
                 $move_to_object = new ProjectObject($move_to_object_id);
                 $link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
                 mysql_select_db(DB_NAME);
                 mysql_query("update healingcrystals_attachments set parent_id='" . $move_to_object->getId() . "', parent_type='" . $move_to_object->getType() . "' where id='" . $this->active_attachment->getId() . "'");
                 mysql_close($link);
                 $type = $move_to_object->getType();
                 $obj = new $type($move_to_object_id);
                 $link = 'Attachment Moved: <a href="' . $obj->getViewUrl() . '">Click to View</a>';
                 $this->smarty->assign('link', $link);
                 break;
         }
     } else {
         $teams = Projects::findNamesByUser($this->logged_user);
         $this->smarty->assign('teams', $teams);
     }
     $parent = $this->active_attachment->getParent();
     $this->smarty->assign('cur_project_id', $parent->getProjectId());
     $this->smarty->assign('cur_attachment_id', $this->active_attachment->getId());
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:69,代码来源:AttachmentsController.class.php

示例4: addInstanceToPool

 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      Attachment $value A Attachment object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(Attachment $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
开发者ID:novesanchez,项目名称:project-travelagency,代码行数:22,代码来源:BaseAttachmentPeer.php

示例5: Project

 /**
  * Provides logic for image picker dialog
  * 
  * @param void
  * @return null
  */
 function image_picker()
 {
     $project_id = $this->request->get('project_id');
     if ($project_id) {
         $this->active_project = Projects::findById($project_id);
     }
     // if
     if (!instance_of($this->active_project, 'Project')) {
         $this->active_project = new Project();
     }
     // if
     $image_picker_url = assemble_url('image_picker', array('project_id' => $this->active_project->getId()));
     $this->smarty->assign(array('image_picker_url' => $image_picker_url, 'disable_upload' => (bool) $this->request->get('disable_upload')));
     if ($this->request->isSubmitted()) {
         $action = $this->request->post('widget_action');
         switch ($action) {
             case 'upload':
                 // check if any file is uploaded
                 $uploaded_file = array_var($_FILES, 'image', null);
                 if (!is_array($uploaded_file)) {
                     $this->httpError(HTTP_ERR_OPERATION_FAILED, lang('You did not uploaded any file'), true, true);
                 }
                 // if
                 // we are setting base attributes
                 $attachment = new Attachment();
                 $attachment->setName($uploaded_file['name']);
                 $attachment->setMimeType($uploaded_file['type']);
                 $attachment->setSize($uploaded_file['size']);
                 $attachment->setAttachmentType(ATTACHMENT_TYPE_ATTACHMENT);
                 $attachment->setCreatedBy($this->logged_user);
                 $attachment->setCreatedOn(new DateTimeValue());
                 // check if uploaded file is image
                 if (!$attachment->isImage()) {
                     $this->httpError(HTTP_ERR_OPERATION_FAILED, lang('Uploaded file is not image'), true, true);
                 }
                 // if
                 $destination_file = get_available_uploads_filename();
                 if (!move_uploaded_file($uploaded_file['tmp_name'], $destination_file)) {
                     $this->httpError(HTTP_ERR_OPERATION_FAILED, lang('Could not copy uploaded image to work folder'), true, true);
                 }
                 // if
                 if (FIX_UPLOAD_PERMISSION !== false) {
                     @chmod($destination_file, FIX_UPLOAD_PERMISSION);
                 }
                 // if
                 $attachment->setLocation(basename($destination_file));
                 $save = $attachment->save();
                 if (!$save || is_error($save)) {
                     @unlink($destination_file);
                     $this->httpError(HTTP_ERR_OPERATION_FAILED, $save->getMessage(), true, true);
                 }
                 // if
                 echo "<img attachment_id='" . $attachment->getId() . "' src='" . $attachment->getViewUrl($this->active_project->getId()) . "' />";
                 die;
                 break;
             default:
                 break;
         }
         // switch
     }
     // if
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:68,代码来源:WidgetsController.class.php


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