本文整理汇总了PHP中Phprojekt类的典型用法代码示例。如果您正苦于以下问题:PHP Phprojekt类的具体用法?PHP Phprojekt怎么用?PHP Phprojekt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Phprojekt类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doLogin
/**
* @param Phprojekt $phprojekt
* @param $username
* @param $password
*/
protected function doLogin($phprojekt)
{
// $this->comment('[Action] Try to login');
try {
$success = $phprojekt->login();
if (!$success) {
exit($this->comment('[Response] Login Failed!'));
}
// $this->comment('[Response] Login successful');
} catch (InvalidArgumentException $e) {
}
}
示例2: 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();
}
示例3: 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();
}
示例4: 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;
}
示例5: __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);
}
示例6: 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);
}
示例7: 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);
}
示例8: __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'));
}
示例9: 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);
}
示例10: 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;
}
}
示例11: 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);
}
示例12: __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);
}
示例13: 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);
}
示例14: testGetModules
/**
* Test getModules
*/
public function testGetModules()
{
$setting = new Phprojekt_Setting();
$data = array();
$data[] = array('name' => 'User', 'label' => Phprojekt::getInstance()->translate('User'));
$data[] = array('name' => 'Notification', 'label' => Phprojekt::getInstance()->translate('Notification'));
$data[] = array('name' => 'Timecard', 'label' => Phprojekt::getInstance()->translate('Timecard'));
$this->assertEquals($data, $setting->getModules());
}
示例15: 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();
}