本文整理汇总了PHP中cssJSToolbox::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP cssJSToolbox::getInstance方法的具体用法?PHP cssJSToolbox::getInstance怎么用?PHP cssJSToolbox::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cssJSToolbox
的用法示例。
在下文中一共展示了cssJSToolbox::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgrade
/**
* put your comment there...
*
*/
public function upgrade()
{
// Save backup in backup table!
$backup = $this->current();
// Change 'time' field to 'created'!
// Convert formatted date to mysal date!
$backup['created'] = $backup['time'];
// User author Id instead of name and change 'author' field to 'owner'!
$backup['owner'] = get_user_by('login', $backup['author'])->ID;
$backup['type'] = 'blocks';
// For now we support only blocks backups!
// Load blocks into blocks iterator before destroying deprectaed fields.
$blocks = new CJTInstallerBlocks03($backup['data'], CJTInstallerBlocks03::BLOCK_TYPE_BACKUP);
// Remove deprecated fields!
$backup = array_diff_key($backup, array_flip(array('time', 'author', 'data')));
/// Add backup and get its ID using OLD style table (not xTable)!!
// Import dependecneis.
cssJSToolbox::import('tables:backups.php');
// Insert backup record.
$backupsTable = new CJTBackupsTable(cssJSToolbox::getInstance()->getDBDriver());
$backupsTable->insert($backup);
$backupId = $backupsTable->getDBDriver()->processQueue()->getInsertId();
// Insert all blocks!
foreach ($blocks as &$block) {
// Associate every block with the created backup!
$block['backupId'] = $backupId;
// Upgrade block!
$blocks->upgrade();
$blocks->model->save();
}
return $this;
}
示例2: delete
/**
* Delete single package.
*
* This method is going to delete the package
* and all the templates and blocks associated to it,
* therefor it'll unlink/break-down the relationship
* between those templates and blocks.
*
* @param Integer Package Id.
* @return CJTPackageModel Return $this.
*/
public function delete($id)
{
// Initialize.
$modelTemplates = CJTModel::getInstance('templates-manager');
$dbd = cssJSToolbox::getInstance()->getDBDriver();
$assoObjectsQueryTmp = 'SELECT objectId
FROM #__cjtoolbox_package_objects
WHERE packageId = %d AND objectType = "%s" AND relType = "%s";';
// Delete the package.
CJTxTable::getInstance('package')->set('id', $id)->delete();
// Delete blocks.
$blockIds = array_keys($dbd->select(sprintf($assoObjectsQueryTmp, $id, 'block', 'add')));
if (!empty($blockIds)) {
// Delete blocks!
CJTModel::getInstance('blocks')->delete($blockIds)->save();
}
// Delete templates.
$modelTemplates->inputs['ids'] = array_keys($dbd->select(sprintf($assoObjectsQueryTmp, $id, 'template', 'add')));
// Templates muct be in trash state before deleted!
$modelTemplates->inputs['state'] = 'trash';
// Move to Trash + Delete only if there is at least one Id!
empty($modelTemplates->inputs['ids']) or $modelTemplates->changeState() and $modelTemplates->delete();
// Delete package objects map.
CJTxTable::getInstance('package-objects')->set('packageId', $id)->delete(array('packageId'));
}
示例3: downloadCodeFileAction
/**
* put your comment there...
*
*/
public function downloadCodeFileAction()
{
// BlockId, currentActiveFile.
$blockId = $_GET['blockId'];
$fileId = $_GET['fileId'];
$returnAs = $_GET['returnAs'];
// Get current File Code.
$tblCodeFile = new CJTBlockFilesTable(cssJSToolbox::getInstance()->getDBDriver());
$codeFile = $tblCodeFile->set('id', $fileId)->set('blockId', $blockId)->load()->getData();
// Return as downloadable-file or JSON.
if ($returnAs == 'file') {
// Get Download File info.
$extension = $codeFile->type ? cssJSToolbox::$config->templates->types[$codeFile->type]->extension : 'txt';
$file = "{$codeFile->name}.{$extension}";
// Response Header parameters.
header('Content-Description: File Transfer');
header("Content-Disposition: attachment; filename=\"{$file}\"");
//<<< Note the " " surrounding the file name
header('Content-Transfer-Encoding: binary');
header('Connection: Keep-Alive');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . strlen($codeFile->code));
// AJAX Controller parameters.
$this->httpContentType = 'application/octet-stream';
}
// Output code.
$this->response = $codeFile->code;
}
示例4: prepareItems
/**
* put your comment there...
*
*/
protected function prepareItems()
{
CJTxTable::import('author');
$internalAuthorsFlag = CJTAuthorTable::FLAG_SYS_AUTHOR;
// Query all dates (without time!) or internal authors.
$query = " SELECT DISTINCT(DATE(t.creationDate)) `text`\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM #__cjtoolbox_templates t\n\t\t\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN #__cjtoolbox_authors a\n\t\t\t\t\t\t\t\t\t\t\t\t\tON t.authorId = a.id\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE (a.attributes & {$internalAuthorsFlag}) = 0\n\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY `text`;";
$this->items = cssJSToolbox::getInstance()->getDBDriver()->select($query);
}
示例5: __construct
/**
* put your comment there...
*
* @param mixed $formId
* @return CJT_Models_Block_Parameters_Form_Groups
*/
public function __construct($formId)
{
// Initialize.
$this->formId = $formId;
$dbDriver = cssJSToolbox::getInstance()->getDBDriver();
// Query groups.
$groups = $dbDriver->select("SELECT * FROM #__cjtoolbox_form_groups g LEFT JOIN #__cjtoolbox_form_group_xfields xf ON g.id = xf.groupId WHERE g.formId = {$this->formId};", ARRAY_A);
parent::__construct($groups);
}
示例6: prepareItems
/**
* put your comment there...
*
*/
protected function prepareItems()
{
// Query CJT Authors + Wordpress build-in local users.
$query = ' SELECT o.ID id, o.user_login `text`
FROM #__wordpress_users o
RIGHT JOIN #__cjtoolbox_templates t
ON o.ID = t.ownerId ORDER BY `text`';
// Get all exists authors
$this->items = cssJSToolbox::getInstance()->getDBDriver()->select($query);
}
示例7: getPackageInfo
/**
* put your comment there...
*
*/
public function getPackageInfo()
{
// Initialize.
$driver = cssJSToolbox::getInstance()->getDBDriver();
// Query package info for the current block.
$query = "SELECT p.id, p.author, p.webSite\n\t\t\t\t\t\t\t\t\t\t\tFROM #__cjtoolbox_packages p RIGHT JOIN #__cjtoolbox_package_objects o\n\t\t\t\t\t\t\t\t\t\t\tON p.id = o.packageId AND o.objectType = 'block'\n\t\t\t\t\t\t\t\t\t\t\tWHERE o.objectId = {$this->id};";
// Exec!
$packageInfo = $driver->getRow($query, ARRAY_A);
return $packageInfo;
}
示例8: prepareItems
/**
* put your comment there...
*
*/
protected function prepareItems()
{
// Import dependencies.
CJTxTable::import('template-revision');
CJTxTable::import('author');
$lastVersionFlag = CJTTemplateRevisionTable::FLAG_LAST_REVISION;
$internalAuthorsFlag = CJTAuthorTable::FLAG_SYS_AUTHOR;
// Query all dates (without time!).
$query = " SELECT DISTINCT(DATE(r.dateCreated)) `text` \n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM #__cjtoolbox_template_revisions r\n\t\t\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN #__cjtoolbox_templates t\n\t\t\t\t\t\t\t\t\t\t\t\t\tON r.templateId = t.id\n\t\t\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN #__cjtoolbox_authors a\n\t\t\t\t\t\t\t\t\t\t\t\t\tON t.authorId = a.id\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE (r.attributes & {$lastVersionFlag}) AND (a.attributes & {$internalAuthorsFlag}) = 0\n\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY `text`";
$this->items = cssJSToolbox::getInstance()->getDBDriver()->select($query);
}
示例9: exec
/**
* put your comment there...
*
*/
public function exec()
{
// Initialize!
$driver = cssJSToolbox::getInstance()->getDBDriver();
// Execute all statements!
foreach ($this->statements as $statement) {
// Terminate the statement with ;
$statement = "{$statement};";
// Execute statement!
$driver->exec($statement);
}
}
示例10: getItems
/**
* put your comment there...
*
*/
public function getItems()
{
// Initializing!
$driver = cssJSToolbox::getInstance()->getDBDriver();
// Get common quiery parts!@
$query = $this->getItemsQuery();
// Add fields list!
$query['select'] = 'b.id, b.name title, b.owner, f.name formTitle';
$query = "SELECT {$query['select']} FROM {$query['from']} WHERE {$query['where']};";
// Retrieve blocks!
return $driver->select($query);
}
示例11: id
/**
* put your comment there...
*
*/
public function id()
{
$id = false;
// If its a normal block just get the id from the KEY!
if ($this->type == self::BLOCK_TYPE_BACKUP) {
$dbDriver = cssJSToolbox::getInstance()->getDBDriver();
$blocksTable = new CJTBlocksTable($dbDriver);
$id = $blocksTable->getNextId();
} else {
// If backup block generate new ID!
$id = parent::id();
}
return $id;
}
示例12: prepareItems
/**
* put your comment there...
*
*/
protected function prepareItems()
{
if (isset($this->options['result']) && $this->options['result'] == 'fullList') {
$this->items['published']['text'] = cssJSToolbox::getText('published');
$this->items['draft']['text'] = cssJSToolbox::getText('draft');
$this->items['trash']['text'] = cssJSToolbox::getText('trash');
} else {
CJTxTable::import('author');
$internalAuthorsFlag = CJTAuthorTable::FLAG_SYS_AUTHOR;
// Query all template state exluding Internal authors.
$query = "SELECT DISTINCT(state) `text` \n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM #__cjtoolbox_templates t\n\t\t\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN #__cjtoolbox_authors a\n\t\t\t\t\t\t\t\t\t\t\t\t\tON t.authorId = a.id\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE (a.attributes & {$internalAuthorsFlag}) = 0\n\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY `text`";
$this->items = cssJSToolbox::getInstance()->getDBDriver()->select($query);
}
}
示例13: assignValues
/**
* put your comment there...
*
*/
protected function assignValues()
{
// Initialize.
$driver = cssJSToolbox::getInstance()->getDBDriver();
// For every parameter assign the values.
foreach ($this->getParams() as $param) {
// Query all values.
$recset = $driver->select("SELECT * \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM #__cjtoolbox_parameter_typedef\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE parameterId = {$param->getId()}", ARRAY_A);
foreach ($recset as $valueRow) {
$param->addValue(new CJT_Models_Block_Parameters_Form_Value($valueRow));
}
}
return $this;
}
示例14: transit
/**
* put your comment there...
*
*/
public function transit()
{
// Get block element.
$register = $this->register();
$blockId = $register['blockId'];
// CodeFiles table.
$tblCodeFile = new CJTBlockFilesTable(cssJSToolbox::getInstance()->getDBDriver());
// Load Code Files if required.
$register['packageParser']->fetchProperty($this->getNode(), 'code');
// Fetch form data / All scalar elements!
$codeFileData = new CJT_Framework_Xml_Fetchscalars($this->getNode());
// Insert Code File.
$tblCodeFile->setData($codeFileData)->set('blockId', $blockId)->save(true, true);
// Chaining.
return $this;
}
示例15: pinsMap
/**
* put your comment there...
*
*/
protected function pinsMap()
{
// Initialize.
$blockId = $this->getBlockId();
$params = $this->getTypeParams();
$pinsMap = array();
// Prepare block pinned items.
$dbDriver = cssJSToolbox::getInstance()->getDBDriver();
$pinsTable = new CJTBlockPinsTable($dbDriver);
$pins = $pinsTable->get(null, array('blockId' => $blockId, 'pin' => $params['group']));
// Create ITEM-ID => VALUE array map for the retrieved pins.
foreach ($pins as $pin) {
$pinsMap[$pin->value] = true;
}
// Returns.
return $pinsMap;
}