本文整理汇总了PHP中Folder::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Folder::getInstance方法的具体用法?PHP Folder::getInstance怎么用?PHP Folder::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Folder
的用法示例。
在下文中一共展示了Folder::getInstance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeDecisionSave
/**
* @param sfWebRequest $request
*/
public function executeDecisionSave(sfWebRequest $request)
{
$decision_id = $this->getUser()->getAttribute('decision_id', null, 'sfGuardSecurityUser');
if ($decision_id) {
$decision = DecisionTable::getInstance()->getDecisionForUser($this->getUser()->getGuardUser(), $decision_id);
$this->forward404Unless(is_object($decision));
} else {
$decision = new Decision();
$decision->type_id = 2;
// Product development
$type_template = TypeTemplate::getInstance()->createQuery('t')->where('t.user_id is NULL')->andWhere('t.type_id = ?', 2)->andWhere('t.name = ?', 'Default')->execute();
$decision->template_id = $type_template[0]->getId();
// Default template
$folder = Folder::getInstance()->createQuery('t')->where('t.user_id = ?', $this->getUser()->getGuardUser()->id)->andWhere('t.deletable = ?', 0)->execute();
if (!empty($folder)) {
$decision->setFolderId($folder[0]->getId());
}
}
$decision->name = $request->getParameter('name');
if ($decision->name == '') {
$decision->name = 'New project';
}
$decision->save();
$this->getUser()->setAttribute('decision_id', $decision->id, 'sfGuardSecurityUser');
$this->redirect('@wizard\\alternatives?decision_id=' . $decision->id);
}
示例2: preSave
public function preSave($event)
{
if (!$this->folder_id) {
$this->folder_id = Folder::getInstance()->getNotDeletableForUser(sfContext::getInstance()->getUser()->getGuardUser(), Folder::TYPE_ROADMAP)->getId();
}
$log = new Log();
$log->injectDataAndPersist($this, sfContext::getInstance()->getUser()->getGuardUser(), array('action' => $this->isNew() ? 'new' : 'edit'));
}
示例3: preSave
public function preSave($event)
{
if (array_key_exists('template_id', $this->getModified()) && !$this->isNew()) {
$this->template_changed = true;
}
if (empty($this->start_date)) {
$this->start_date = null;
}
if (empty($this->end_date)) {
$this->end_date = null;
}
if (!$this->folder_id) {
$this->folder_id = Folder::getInstance()->getNotDeletableForUser(sfContext::getInstance()->getUser()->getGuardUser(), Folder::TYPE_PROJECT)->getId();
}
}
示例4: executeNewFolder
public function executeNewFolder(sfWebRequest $request)
{
$this->forward404Unless($request->isXmlHttpRequest());
$folder = new Folder();
$folder->setName('New ' . InterfaceLabelTable::getInstance()->get($this->getuser()->getGuardUser(), InterfaceLabelTable::FOLDER_TYPE));
$folder->setUser($this->getUser()->getGuardUser());
$folder->setType(Folder::TYPE_ROADMAP);
if (!Folder::getInstance()->getNotDeletableForUser($this->getUser()->getGuardUser(), Folder::TYPE_ROADMAP, false)) {
$folder->setDeletable(false);
}
$folder->save();
// Create log
$log = new Log();
$log->injectDataAndPersist($folder, $this->getUser()->getGuardUser(), array('action' => 'new'));
return $this->renderText(json_encode($folder->getRowData()));
}