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


PHP Phprojekt::getInstance方法代码示例

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


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

示例1: __construct

 /**
  * Constructor
  */
 public function __construct($db = null)
 {
     if (is_null($db)) {
         $db = Phprojekt::getInstance()->getDb();
     }
     $this->_proxyTable = new Zend_Db_Table(array('db' => $db, 'name' => 'user_proxy'));
 }
开发者ID:RainyBlueSky,项目名称:PHProjekt,代码行数:10,代码来源:ProxyTable.php

示例2: errorAction

 /**
  * Default error action.
  *
  * On Phprojekt_PublishedException, return an error string in JSON format.
  * <pre>
  *  - type    => 'error'.
  *  - message => Error message.
  *  - code    => Error code.
  * </pre>
  *
  * On wrong controller name or action, terminates script execution.
  *
  * In all cases, the error is logged.
  *
  * @return void
  */
 public function errorAction()
 {
     $error = $this->_getParam('error_handler');
     $this->getResponse()->clearBody();
     switch ($error->type) {
         case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
         case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
             // 404 error -- controller or action not found
             $this->getResponse()->setRawHeader('HTTP/1.1 404 Not Found');
             $message = "The url " . Cleaner::sanitize('xss', urldecode($error->request->getRequestUri())) . " do not exists";
             Phprojekt::getInstance()->getLog()->err($message);
             die($message);
             break;
         default:
             $exception = $error->exception;
             // We only forward exception with type PublishedException
             if ($exception instanceof Phprojekt_PublishedException) {
                 $error = array('type' => 'error', 'message' => $exception->getMessage(), 'code' => $exception->getCode());
                 echo '{}&&(' . Zend_Json_Encoder::encode($error) . ')';
             } else {
                 $logger = Phprojekt::getInstance()->getLog();
                 $logger->err($exception->getMessage() . "\n" . $exception->getTraceAsString());
             }
             break;
     }
 }
开发者ID:penSecIT,项目名称:PHProjekt,代码行数:42,代码来源:ErrorController.php

示例3: setUp

 /**
  * setup the unit test. Use firefox as a browser and the document
  * root from the configuration file
  *
  * @return void
  */
 function setUp()
 {
     $this->setAutoStop(false);
     $this->config = Phprojekt::getInstance()->getConfig();
     $this->verificationErrors = array();
     $this->setBrowserUrl($this->config->webpath);
 }
开发者ID:penSecIT,项目名称:PHProjekt,代码行数:13,代码来源:SeleniumInit.php

示例4: __construct

 /**
  * Constructor
  *
  * @param string $name The name of the file to represent
  * @param string $hash The md5 hash of the file to represent
  * @param Filemanager_Models_Filemanager
  *               $filemanager The filemanager object that the file is a part of.
  */
 public function __construct($name, $hash, $filemanager)
 {
     $this->_name = $name;
     $this->_hash = $hash;
     $this->_filemanager = $filemanager;
     parent::__construct(Phprojekt::getInstance()->getConfig()->uploadPath . '/' . $hash);
 }
开发者ID:RainyBlueSky,项目名称:PHProjekt,代码行数:15,代码来源:FilemanagerFile.php

示例5: errorAction

 /**
  * Default error action.
  *
  * On Zend_Controller_Action_Exception, if the error code is 4xx return an error message matching the accepted type.
  *
  * On wrong controller name or action, terminates script execution.
  *
  * In all cases, the error is logged.
  *
  * @return void
  */
 public function errorAction()
 {
     $error = $this->_getParam('error_handler');
     $this->getResponse()->clearBody();
     $exception = $error->exception;
     $viewerror = array('type' => 'error', 'message' => 'Internal Server Error');
     switch ($error->type) {
         case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
         case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
             // 404 error -- controller or action not found
             $this->getResponse()->setHttpResponseCode(404);
             $message = "The url " . Cleaner::sanitize('xss', urldecode($error->request->getRequestUri())) . " do not exists";
             Phprojekt::getInstance()->getLog()->err($message);
             die($message);
             break;
         default:
             // We only forward exception with 4xx code to the client
             if ($exception instanceof Zend_Controller_Action_Exception && $exception->getCode() >= 400 && $exception->getCode() < 500) {
                 $this->getResponse()->setHttpResponseCode($exception->getCode());
                 $viewerror['message'] = $exception->getMessage();
             } else {
                 $this->getResponse()->setHttpResponseCode(500);
                 $logger = Phprojekt::getInstance()->getLog();
                 $logger->err($exception->getMessage() . "\n" . $exception->getTraceAsString());
             }
             break;
     }
     $this->view->error = $viewerror;
 }
开发者ID:RainyBlueSky,项目名称:PHProjekt,代码行数:40,代码来源:ErrorController.php

示例6: getPdf

 /**
  * Creates a PDF report from the Minutes model given.
  * Returns the PDF as a string that can either be saved to disk
  * or streamed back to the browser.
  *
  * @param Phprojekt_Model_Interface $minutesModel The minutes model object to create the PDF from.
  *
  * @return string The resulting PDF document.
  */
 public static function getPdf(Phprojekt_Model_Interface $minutesModel)
 {
     $phpr = Phprojekt::getInstance();
     $pdf = new Zend_Pdf();
     $page = new Phprojekt_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
     $pages = array($page);
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 12);
     $page->setBorder(2.0 * Phprojekt_Pdf_Page::PT_PER_CM, 2.0 * Phprojekt_Pdf_Page::PT_PER_CM, 2.0 * Phprojekt_Pdf_Page::PT_PER_CM, 3.0 * Phprojekt_Pdf_Page::PT_PER_CM);
     $page->addFreetext(array('lines' => $minutesModel->title, 'fontSize' => 20));
     $page->addFreetext(array('lines' => array_merge(explode("\n\n", $minutesModel->description), array($phpr->translate('Start') . ': ' . $minutesModel->meetingDatetime, $phpr->translate('End') . ': ' . $minutesModel->endTime, $phpr->translate('Place') . ': ' . $minutesModel->place, $phpr->translate('Moderator') . ': ' . $minutesModel->moderator)), 'fontSize' => 12));
     $invited = Minutes_Helpers_Userlist::expandIdList($minutesModel->participantsInvited);
     $attending = Minutes_Helpers_Userlist::expandIdList($minutesModel->participantsAttending);
     $excused = Minutes_Helpers_Userlist::expandIdList($minutesModel->participantsExcused);
     $pages += $page->addTable(array('fontSize' => 12, 'rows' => array(array(array('text' => $phpr->translate('Invited'), 'width' => 4.7 * Phprojekt_Pdf_Page::PT_PER_CM), array('text' => array_reduce($invited, array('self', '_concat')), 'width' => 12.0 * Phprojekt_Pdf_Page::PT_PER_CM)), array(array('text' => $phpr->translate('Attending'), 'width' => 4.7 * Phprojekt_Pdf_Page::PT_PER_CM), array('text' => array_reduce($attending, array('self', '_concat')), 'width' => 12.0 * Phprojekt_Pdf_Page::PT_PER_CM)), array(array('text' => $phpr->translate('Excused'), 'width' => 4.7 * Phprojekt_Pdf_Page::PT_PER_CM), array('text' => array_reduce($excused, array('self', '_concat')), 'width' => 12.0 * Phprojekt_Pdf_Page::PT_PER_CM)))));
     $page = end($pages);
     $itemtable = array();
     $items = $minutesModel->items->fetchAll();
     foreach ($items as $item) {
         $itemtable[] = array(array('text' => $item->topicId, 'width' => 1.3 * Phprojekt_Pdf_Page::PT_PER_CM), array('text' => $phpr->translate($item->information->getTopicType($item->topicType)), 'width' => 3.0 * Phprojekt_Pdf_Page::PT_PER_CM), array('text' => $item->getDisplay(), 'width' => 12.4 * Phprojekt_Pdf_Page::PT_PER_CM));
     }
     $pages += $page->addTable(array('fontSize' => 12, 'rows' => array_merge(array(array('isHeader' => true, array('text' => $phpr->translate('No.'), 'width' => 1.3 * Phprojekt_Pdf_Page::PT_PER_CM), array('text' => $phpr->translate('Type'), 'width' => 3.0 * Phprojekt_Pdf_Page::PT_PER_CM), array('text' => $phpr->translate('Item'), 'width' => 12.4 * Phprojekt_Pdf_Page::PT_PER_CM))), $itemtable)));
     $page = end($pages);
     $pdf->pages = $pages;
     $pdf->properties['Title'] = $minutesModel->title;
     $owner = Minutes_Helpers_Userlist::expandIdList($minutesModel->ownerId);
     $pdf->properties['Author'] = $owner[0]['display'];
     $pdf->properties['Producer'] = 'PHProjekt version ' . Phprojekt::getVersion();
     $pdf->properties['CreationDate'] = 'D:' . gmdate('YmdHis');
     $pdf->properties['Keywords'] = $minutesModel->description;
     return $pdf->render();
 }
开发者ID:penSecIT,项目名称:PHProjekt,代码行数:40,代码来源:Pdf.php

示例7: getDisplay

 /**
  * Return the display data for a moduleId-ItemId pair.
  *
  * @param array $data Array with the module data for show (moduleId => itemId).
  *
  * @return array Array with 'id', 'moduleId', 'moduleName', 'moduleLabel',
  *                          'firstDisplay', 'secondDisplay' and 'projectId'.
  */
 public function getDisplay($data)
 {
     $results = array();
     foreach ($data as $moduleId => $content) {
         $ids = array();
         foreach ($content as $id) {
             $ids[] = (int) $id;
         }
         if (!empty($ids)) {
             $where = sprintf('module_id = %d AND item_id IN (%s)', (int) $moduleId, implode(', ', $ids));
             $tmpResult = $this->fetchAll($where)->toArray();
             $moduleName = Phprojekt_Module::getModuleName($moduleId);
             $moduleLabel = Phprojekt::getInstance()->translate(Phprojekt_Module::getModuleLabel($moduleId), null, $moduleName);
             foreach ($tmpResult as $result) {
                 $index = $moduleId . '-' . $result['item_id'];
                 $results[$index] = array('id' => (int) $result['item_id'], 'moduleId' => (int) $moduleId, 'moduleName' => $moduleName, 'moduleLabel' => $moduleLabel, 'firstDisplay' => $result['first_display'], 'secondDisplay' => $result['second_display'], 'projectId' => (int) $result['project_id']);
             }
             foreach ($ids as $id) {
                 $index = $moduleId . '-' . $id;
                 if (!isset($results[$index])) {
                     $results[$index] = array('id' => (int) $id, 'moduleId' => (int) $moduleId, 'moduleName' => Phprojekt_Module::getModuleName($moduleId), 'moduleLabel' => $moduleLabel, 'firstDisplay' => '', 'secondDisplay' => '', 'projectId' => 1);
                 }
             }
         }
     }
     return array_values($results);
 }
开发者ID:RainyBlueSky,项目名称:PHProjekt,代码行数:35,代码来源:Display.php

示例8: indexAction

 public function indexAction()
 {
     // Set the root directory
     $webdavPath = Phprojekt::getInstance()->getConfig()->webdavPath;
     if (Phprojekt_Auth::isLoggedIn()) {
         $project = new Project_Models_Project();
         $project = $project->find(1);
         $rootDirectory = new WebDAV_Models_ProjectDirectory($project);
     } else {
         // Some clients seem to send some queries without http auth. We need the dummy to serve those.
         $rootDirectory = new WebDAV_Models_EmptyDir();
     }
     // The server object is responsible for making sense out of the WebDAV protocol
     $server = new Sabre_DAV_Server($rootDirectory);
     $server->setBaseUri($this->view->baseUrl('index.php/WebDAV/index/index/'));
     // The lock manager is reponsible for making sure users don't overwrite each others changes.
     // Change 'data' to a different directory, if you're storing your data somewhere else.
     $lockBackend = new Sabre_DAV_Locks_Backend_File($webdavPath . 'data/locks');
     $lockPlugin = new Sabre_DAV_Locks_Plugin($lockBackend);
     $server->addPlugin($lockPlugin);
     // Authentication
     $authBackend = new WebDAV_Helper_Auth();
     $authPlugin = new Sabre_DAV_Auth_Plugin($authBackend, 'WebDAV');
     $server->addPlugin($authPlugin);
     // All we need to do now, is to fire up the server
     $server->exec();
 }
开发者ID:RainyBlueSky,项目名称:PHProjekt,代码行数:27,代码来源:IndexController.php

示例9: testGetModel

 /**
  * Test the getModel functionality
  */
 public function testGetModel()
 {
     $name = new Project_Models_Project();
     $this->assertEquals('Project_Models_Project', get_class($name));
     $instance = new $name(array('db' => Phprojekt::getInstance()->getDb()));
     $this->assertTrue($instance instanceof Project_Models_Project);
 }
开发者ID:RainyBlueSky,项目名称:PHProjekt,代码行数:10,代码来源:LoaderTest.php

示例10: testLog

 /**
  * Normal cal
  */
 public function testLog()
 {
     $config = Phprojekt::getInstance()->getConfig();
     $log = new Phprojekt_Log($config);
     $log->log('TEST', Zend_Log::DEBUG);
     $log->log('TEST', Zend_Log::CRIT);
     $log->log('TEST', Zend_Log::INFO);
 }
开发者ID:RainyBlueSky,项目名称:PHProjekt,代码行数:11,代码来源:LogTest.php

示例11: __construct

 /**
  * Construct a new instance with the given path.
  *
  * The path defines where to search for extensions.
  *
  * @param string $path The directory to search for extensions.
  */
 public function __construct($path)
 {
     $this->_log = Phprojekt::getInstance()->getLog();
     $this->_config = Phprojekt::getInstance()->getConfig();
     $this->_cache = Phprojekt::getInstance()->getCache();
     $this->_path = $path;
     $this->_cacheNs = self::CACHE_NS . md5($this->_path);
 }
开发者ID:RainyBlueSky,项目名称:PHProjekt,代码行数:15,代码来源:Extensions.php

示例12: testMigrationMakesFilenamesUnique

 public function testMigrationMakesFilenamesUnique()
 {
     $migration = new Filemanager_Migration();
     $migration->upgrade('6.1.0', Phprojekt::getInstance()->getDb());
     $rows = Phprojekt::getInstance()->getDb()->select()->from('filemanager', array('id', 'files'))->order('id')->query()->fetchAll();
     $expected = array(array('id' => '1', 'files' => '966f9bfa01ec4a2a3fa6282bb8fa8d56|articles.txt (1)||aaaaaa|articles.txt (2)'), array('id' => '2', 'files' => 'deadbeef01ec4a2a3fa6282bb8fa8d56|articles.txt|articles.txt2'), array('id' => '3', 'files' => '2b00042f7481c7b056c4b410d28f33cf|foo (1)||' . '2219d815ba0757484194cac396115c6a|foo (2)||' . 'd8016131a2724252b2419bf645aab221|bar'));
     $this->assertEquals($expected, $rows);
 }
开发者ID:RainyBlueSky,项目名称:PHProjekt,代码行数:8,代码来源:MigrationTest.php

示例13: setUp

 /**
  * setUp method for PHPUnit. We use a shared db connection
  */
 public function setUp()
 {
     parent::setUp();
     $this->_emptyResult = array();
     $this->_formResult = array('projectId' => array('id' => '', 'tableName' => '', 'tablefield' => '', 'formTab' => '', 'formLabel' => '', 'formType' => '', 'formPosition' => '', 'formColumns' => '', 'formRegexp' => '', 'formRange' => '', 'defaultValue' => '', 'listPosition' => '', 'listAlign' => '', 'listUseFilter' => '', 'altPosition' => '', 'status' => '', 'isInteger' => '', 'isRequired' => '', 'isUnique' => ''), 'title' => array('id' => '', 'tableName' => '', 'tablefield' => '', 'formTab' => '', 'formLabel' => '', 'formType' => '', 'formPosition' => '', 'formColumns' => '', 'formRegexp' => '', 'formRange' => '', 'defaultValue' => '', 'listPosition' => '', 'listAlign' => '', 'listUseFilter' => '', 'altPosition' => '', 'status' => '', 'isInteger' => '', 'isRequired' => '', 'isUnique' => ''), 'notes' => array('id' => '', 'tableName' => '', 'tablefield' => '', 'formTab' => '', 'formLabel' => '', 'formType' => '', 'formPosition' => '', 'formColumns' => '', 'formRegexp' => '', 'formRange' => '', 'defaultValue' => '', 'listPosition' => '', 'listAlign' => '', 'listUseFilter' => '', 'altPosition' => '', 'status' => '', 'isInteger' => '', 'isRequired' => '', 'isUnique' => ''), 'startDate' => array('id' => '', 'tableName' => '', 'tablefield' => '', 'formTab' => '', 'formLabel' => '', 'formType' => '', 'formPosition' => '', 'formColumns' => '', 'formRegexp' => '', 'formRange' => '', 'defaultValue' => '', 'listPosition' => '', 'listAlign' => '', 'listUseFilter' => '', 'altPosition' => '', 'status' => '', 'isInteger' => '', 'isRequired' => '', 'isUnique' => ''), 'endDate' => array('id' => '', 'tableName' => '', 'tablefield' => '', 'formTab' => '', 'formLabel' => '', 'formType' => '', 'formPosition' => '', 'formColumns' => '', 'formRegexp' => '', 'formRange' => '', 'defaultValue' => '', 'listPosition' => '', 'listAlign' => '', 'listUseFilter' => '', 'altPosition' => '', 'status' => '', 'isInteger' => '', 'isRequired' => '', 'isUnique' => ''), 'priority' => array('id' => '', 'tableName' => '', 'tablefield' => '', 'formTab' => '', 'formLabel' => '', 'formType' => '', 'formPosition' => '', 'formColumns' => '', 'formRegexp' => '', 'formRange' => '', 'defaultValue' => '', 'listPosition' => '', 'listAlign' => '', 'listUseFilter' => '', 'altPosition' => '', 'status' => '', 'isInteger' => '', 'isRequired' => '', 'isUnique' => ''), 'currentStatus' => array('id' => '', 'tableName' => '', 'tablefield' => '', 'formTab' => '', 'formLabel' => '', 'formType' => '', 'formPosition' => '', 'formColumns' => '', 'formRegexp' => '', 'formRange' => '', 'defaultValue' => '', 'listPosition' => '', 'listAlign' => '', 'listUseFilter' => '', 'altPosition' => '', 'status' => '', 'isInteger' => '', 'isRequired' => '', 'isUnique' => ''), 'completePercent' => array('id' => '', 'tableName' => '', 'tablefield' => '', 'formTab' => '', 'formLabel' => '', 'formType' => '', 'formPosition' => '', 'formColumns' => '', 'formRegexp' => '', 'formRange' => '', 'defaultValue' => '', 'listPosition' => '', 'listAlign' => '', 'listUseFilter' => '', 'altPosition' => '', 'status' => '', 'isInteger' => '', 'isRequired' => '', 'isUnique' => ''), 'budget' => array('id' => '', 'tableName' => '', 'tablefield' => '', 'formTab' => '', 'formLabel' => '', 'formType' => '', 'formPosition' => '', 'formColumns' => '', 'formRegexp' => '', 'formRange' => '', 'defaultValue' => '', 'listPosition' => '', 'listAlign' => '', 'listUseFilter' => '', 'altPosition' => '', 'status' => '', 'isInteger' => '', 'isRequired' => '', 'isUnique' => ''));
     $this->_listResult = array('title' => $this->_formResult['title'], 'startDate' => $this->_formResult['startDate'], 'endDate' => $this->_formResult['endDate'], 'priority' => $this->_formResult['priority'], 'currentStatus' => $this->_formResult['currentStatus'], 'completePercent' => $this->_formResult['completePercent']);
     $this->_filterResult = array('title' => $this->_formResult['title'], 'start_date' => $this->_formResult['startDate'], 'end_date' => $this->_formResult['endDate'], 'priority' => $this->_formResult['priority'], 'current_status' => $this->_formResult['currentStatus'], 'complete_percent' => $this->_formResult['completePercent']);
     $this->sharedFixture = Phprojekt::getInstance()->getDb();
 }
开发者ID:RainyBlueSky,项目名称:PHProjekt,代码行数:12,代码来源:AbstractTest.php

示例14: __construct

 /**
  * Initialize new tab.
  *
  * @param array $db Configuration for Zend_Db_Table.
  *
  * @return void
  */
 public function __construct($db = null)
 {
     if (null === $db) {
         $db = Phprojekt::getInstance()->getDb();
     }
     parent::__construct($db);
     $this->_validate = new Phprojekt_Model_Validate();
     $this->_informationManager = new Phprojekt_Tab_Information();
 }
开发者ID:RainyBlueSky,项目名称:PHProjekt,代码行数:16,代码来源:Tab.php

示例15: __construct

 /**
  * Initialize new tab.
  *
  * @param array $db Configuration for Zend_Db_Table.
  *
  * @return void
  */
 public function __construct($db = null)
 {
     if (null === $db) {
         $db = Phprojekt::getInstance()->getDb();
     }
     parent::__construct($db);
     $this->_validate = Phprojekt_Loader::getLibraryClass('Phprojekt_Model_Validate');
     $this->_informationManager = Phprojekt_Loader::getLibraryClass('Phprojekt_Tab_Information');
 }
开发者ID:penSecIT,项目名称:PHProjekt,代码行数:16,代码来源:Tab.php


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