/** * Copies project icon to export folder * * @param void * @return void * */ function outputProjectIcon() { $path = $this->active_project->getIconPath(true); $path = is_file($path) ? $path : PUBLIC_PATH . "/projects_icons/default.40x40.gif"; $result = copy($path, $this->getAttachmentsOutputFolder() . '/project_logo.gif'); if ($result === false) { $this->execution_log->addWarning(lang("Failed to copy project icon from") . ": " . $this->active_project->getIconPath(true) . " " . lang('to') . " " . $this->getAttachmentsOutputFolder() . '/project_logo.gif'); } // if return true; }
/** * Delete Project Icon * * @param void * @return null */ function delete_icon() { if ($this->active_project->isNew()) { $this->httpError(HTTP_ERR_NOT_FOUND); } // if if (!$this->active_project->canEdit($this->logged_user)) { $this->httpError(HTTP_ERR_FORBIDDEN); } // if if ($this->request->isSubmitted()) { unlink($this->active_project->getIconPath()); unlink($this->active_project->getIconPath(true)); cache_remove('project_icons'); if ($this->request->isAsyncCall()) { $this->serveData(array('message' => lang('Icon successfully removed'), 'icon' => $this->active_project->getIconUrl(true)), 'delete', null, FORMAT_JSON); } else { $this->redirectToUrl($this->active_project->getEditIconUrl()); } } else { $this->httpError(HTTP_ERR_BAD_REQUEST); } // if }