本文整理汇总了PHP中MVCUtils类的典型用法代码示例。如果您正苦于以下问题:PHP MVCUtils类的具体用法?PHP MVCUtils怎么用?PHP MVCUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MVCUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SMARTY_templateLink
/**
* Create template link
*
* Will create a link to a template specified by either an 'id' or 'name'
* parameter. Any parameters starting with '_' will be added to the query
* string (without the _). This allows you to pass extra info in the
* link. use parameter target to set the html target value
*/
public static function SMARTY_templateLink($params)
{
global $cfg;
$text = $params['text'];
if (isset($params['name'])) {
$id = MVCUtils::getTemplateID($params['name']);
} elseif (isset($params['id'])) {
$id = $params['id'];
} else {
//$id = default template
}
if (isset($params['target'])) {
$target = "target='" . $params['target'] . "'";
} else {
$target = '';
}
$extraQueryInfo = "";
foreach ($params as $k => $v) {
if (substr($k, 0, 1) == '_') {
$k = substr($k, 1);
$extraQueryInfo .= "&{$k}={$v}";
}
}
$path = $cfg['general']['siteRoot'] . "?templateID={$id}" . $extraQueryInfo;
return "<a href='{$path}' {$target}>{$text}</a>";
}
示例2: setupTemplate
protected function setupTemplate()
{
global $cfg;
parent::setupTemplate();
$loginTplID = MVCUtils::getTemplateID('login.tpl');
$this->assign('loginTplID', $loginTplID);
}
示例3: isValid
public function isValid()
{
global $cfg;
$db = Database::getInstance($cfg['MVC']['dsn']);
$rules = $db->getAll("SELECT vrclassname, description, fieldname, \r\n\t\t\tfieldvalidators.modulename FROM fieldvalidators, formfields \r\n\t\t\tWHERE formfields.ruleid = fieldvalidators.ruleid\r\n\t\t\tAND formname = '{$this->formName}'");
//This statement has been removed from the where clause:
//modulename = '{$this->fieldData['moduleName']}' AND
$invalidFields = array();
$sess = Session::getInstance();
// Validate the submitted fields
foreach ($rules as $rule) {
MVCUtils::includeValidator($rule['vrclassname'], $rule['modulename']);
eval("\$validatorObj = new {$rule['vrclassname']}(\$this->fieldData);");
$vResult = $validatorObj->isValid($this->fieldData[$rule['fieldname']]);
if ($vResult !== true) {
//Put the errors:
// a) straight into the errors array for backwards compatibility
// b) into a sub array, whose key is the submitted value for
// errorFormName, otherwise use the form name
$invalidFields[$rule['fieldname']] = $vResult;
if (!$this->errorFormName) {
$invalidFields[$this->formName][$rule['fieldname']] = $vResult;
} else {
$invalidFields[$this->errorFormName][$rule['fieldname']] = $vResult;
}
}
if ($sess->keyExists('auth_user')) {
BasicLogger::logMessage($sess->getValue('auth_user'), self::module, "debug");
}
}
if (!checkdate($this->fieldData['month'], $this->fieldData['day'], $this->fieldData['year']) || !is_numeric($this->fieldData['month']) || !is_numeric($this->fieldData['day']) || !is_numeric($this->fieldData['year'])) {
$invalidFields[$this->formName]['form'] = "Invalid Date";
}
return $invalidFields;
}
示例4: SMARTY_getTemplateID
public function SMARTY_getTemplateID($params)
{
if (isset($params['name'])) {
return MVCUtils::getTemplateID($params['name']);
} else {
return '';
}
}
示例5: __construct
/**
* Construct the object
*
* @param Exception The exception to be made user friendly
*/
public function __construct($exception)
{
global $cfg;
$this->template = new Smarty();
$this->template->compile_dir = $cfg['smarty']['compiledir'];
$this->exception = $exception;
$this->templateFileName = MVCUtils::findTemplate($cfg['smarty']['RenderedexceptionTemplateFile']);
$this->_setupTemplate();
}
示例6: processInvalid
protected function processInvalid()
{
//No invalid processing required
if ($this->errors['form']) {
MVCUtils::redirect(MVCUtils::getTemplateID('dpsuserdirmove.tpl'), array("rootdir" => $this->fieldData['dirID'], "error" => "form"));
} else {
MVCUtils::redirect(MVCUtils::getTemplateID('dpsuserdirmove.tpl'), array("rootdir" => $this->fieldData['dirID'], "error" => "perm"));
}
}
示例7: smarty_resource_rfile_timestamp
public static function smarty_resource_rfile_timestamp($templateName, &$timestamp, &$smarty)
{
global $cfg;
$file = MVCUtils::findTemplate($templateName);
if ($file === false) {
return false;
} else {
return true;
}
}
示例8: setupTemplate
protected function setupTemplate()
{
parent::setupTemplate();
$tid = $this->fieldData['editid'];
$this->assign('templateID', $tid);
$this->assign('templateFileName', MVCUtils::getTemplateFileName($tid));
$this->assign('templateModel', MVCUtils::getModelClassNameFromDB($tid));
$this->assign('templateViewer', MVCUtils::getViewerClassNameFromDB($tid));
$this->assign('templateRealm', MVCUtils::getRealmIDFromDB($tid));
}
示例9: processInvalid
protected function processInvalid()
{
//No invalid processing required
if ($this->errors['text']) {
MVCUtils::redirect(MVCUtils::getTemplateID('dpssteditawitem.tpl'), array("awitemID" => $this->fieldData['awitemID'], "error" => "text"));
} elseif ($this->errors['style']) {
MVCUtils::redirect(MVCUtils::getTemplateID('dpssteditawitem.tpl'), array("awitemID" => $this->fieldData['awitemID'], "error" => "style"));
} elseif ($this->errors['audioID']) {
MVCUtils::redirect(MVCUtils::getTemplateID('dpssteditawitem.tpl'), array("awitemID" => $this->fieldData['awitemID'], "error" => "audioID"));
}
}
示例10: processValid
protected function processValid()
{
global $cfg;
$db = Database::getInstance($cfg['DPS']['dsn']);
$where = "id = " . pg_escape_string($this->fieldData['scriptID']);
$item['name'] = $this->fieldData['name'];
$item['contents'] = $this->fieldData['content'];
$item['length'] = 60 * $this->fieldData['mins'] + $this->fieldData['secs'];
$db->update('scripts', $item, $where, true);
if (isset($this->fieldData['Submit'])) {
MVCUtils::redirect(44);
}
}
示例11: assignViewerNames
protected function assignViewerNames()
{
global $cfg;
$db = Database::getInstance($cfg['MVC']['dsn']);
$physicalViewers = MVCUtils::listPresent('viewer');
for ($i = 0; $i < count($physicalViewers); $i++) {
$tmp = preg_split('/\\./', $physicalViewers[$i]);
$physicalViewers[$i] = $tmp[0];
}
if (count($physicalViewers) > 0) {
$this->assign("viewers", $physicalViewers);
}
}
示例12: isValid
public function isValid(&$data)
{
global $cfg;
$db = Database::getInstance($cfg['MVC']['dsn']);
$data = $db->quoteSmart($data);
$exists = $db->getOne("SELECT COUNT(*) FROM templates WHERE filename = {$data}");
if ($exists > 0) {
return 'The specified template is already in use';
} elseif (MVCUtils::findTemplate($data) === false) {
return 'The specified template does not exist';
} else {
return true;
}
}
示例13: processValid
protected function processValid()
{
global $cfg;
$db = Database::getInstance($cfg['DPS']['dsn']);
$sql = "SELECT COUNT(*) FROM showitems \n\t\t\tWHERE showplanid = " . $this->fieldData['showID'];
$pos = $db->getOne($sql);
$pos++;
$showitem['showplanid'] = $this->fieldData['showID'];
$showitem['position'] = $pos;
$showitem['title'] = 'New Item';
$showitem['length'] = 0;
$showitem['id'] = '#id#';
$itemID = $db->insert('showitems', $showitem, true);
MVCUtils::redirect("58", array("itemID" => $itemID));
}
示例14: processValid
protected function processValid()
{
global $cfg;
$db = Database::getInstance($cfg['DPS']['dsn']);
$auth = Auth::getInstance();
$userID = $auth->getUserID();
$userName = $auth->getUser();
$sql = "SELECT id FROM dir\n\t\t\t\tWHERE parent = " . $cfg['DPS']['userDirectoryID'] . "\n\t\t\t\tAND name = '" . $userName . "'";
$dirID = $db->getOne($sql);
if ($dirID == '') {
$newdir['name'] = $userName;
$newdir['parent'] = $cfg['DPS']['userDirectoryID'];
$newdir['id'] = '#id#';
$newdir['notes'] = $userName . "'s home directory";
$newdir['inherit'] = 'f';
$dirID = $db->insert('dir', $newdir, true);
$newperm['dirid'] = $dirID;
$newperm['userid'] = $userID;
$newperm['permissions'] = 'B' . $cfg['DPS']['fileRW'] . 'B';
$db->insert('dirusers', $newperm, false);
//for binary insert
$sql_gperm['dirid'] = $dirID;
$sql_gperm['permissions'] = 'B' . $cfg['DPS']['fileRWO'] . 'B';
$sql_gperm['groupid'] = $cfg['Auth']['AdminGroup'];
$db->insert('dirgroups', $sql_gperm, false);
}
$newscript['name'] = "New Script";
$newscript['userid'] = $userID;
$newscript['creationdate'] = time();
$newscript['id'] = '#id#';
$newscript['length'] = 0;
$scriptID = $db->insert('scripts', $newscript, true);
$newsperm['scriptid'] = $scriptID;
$newsperm['userid'] = $userID;
$newsperm['permissions'] = 'B' . $cfg['DPS']['fileRWO'] . 'B';
//own
$db->insert('scriptsusers', $newsperm, false);
//for binary insert
$gperm['groupid'] = $cfg['Auth']['AdminGroup'];
$gperm['scriptid'] = $scriptID;
$gperm['permissions'] = 'B' . $cfg['DPS']['fileRWO'] . 'B';
$db->insert('scriptsgroups', $gperm, false);
$scriptdir['scriptid'] = $scriptID;
$scriptdir['dirid'] = $dirID;
$scriptdir['linktype'] = 0;
$db->insert('scriptsdir', $scriptdir, true);
MVCUtils::redirect(45, array("scriptID" => $scriptID));
}
示例15: processValid
protected function processValid()
{
global $cfg;
$db = Database::getInstance($cfg['DPS']['dsn']);
$auth = Auth::getInstance();
$userID = $auth->getUserID();
$userName = $auth->getUser();
$sql = "SELECT id FROM dir \n\t\t\t\tWHERE parent = " . $cfg['DPS']['userDirectoryID'] . "\n\t\t\t\tAND name = '" . $userName . "'";
$dirID = $db->getOne($sql);
if ($dirID == '') {
$newdir['name'] = $userName;
$newdir['parent'] = $cfg['DPS']['userDirectoryID'];
$newdir['id'] = '#id#';
$newdir['notes'] = $userName . "'s home directory";
$newdir['inherit'] = 'f';
$dirID = $db->insert('dir', $newdir, true);
$newperm['dirid'] = $dirID;
$newperm['userid'] = $userID;
$newperm['permissions'] = 'B' . $cfg['DPS']['fileRW'] . 'B';
$db->insert('dirusers', $newperm, false);
//for binary
$sql_gperm['dirid'] = $dirID;
$sql_gperm['permissions'] = 'B' . $cfg['DPS']['fileRWO'] . 'B';
$sql_gperm['groupid'] = $cfg['Auth']['AdminGroup'];
$db->insert('dirgroups', $sql_gperm, false);
}
$newshow['name'] = "New Show";
$newshow['userid'] = $userID;
$newshow['creationdate'] = time();
$newshow['showdate'] = mktime(date('H', time()), 0, 0) + 604800;
$newshow['completed'] = 'f';
$newshow['id'] = '#id#';
$showID = $db->insert('showplans', $newshow, true);
$newsperm['showplanid'] = $showID;
$newsperm['userid'] = $userID;
$newsperm['permissions'] = 'B' . $cfg['DPS']['fileRWO'] . 'B';
$db->insert('showplansusers', $newsperm, false);
//for binary
$gperm['groupid'] = $cfg['Auth']['AdminGroup'];
$gperm['showplanid'] = $showID;
$gperm['permissions'] = 'B' . $cfg['DPS']['fileRWO'] . 'B';
$db->insert('showplansgroups', $gperm, false);
$showdir['showplanid'] = $showID;
$showdir['dirid'] = $dirID;
$showdir['linktype'] = 0;
$db->insert('showplansdir', $showdir, true);
MVCUtils::redirect("55", array("showID" => $showID));
}