本文整理汇总了PHP中Kit类的典型用法代码示例。如果您正苦于以下问题:PHP Kit类的具体用法?PHP Kit怎么用?PHP Kit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Kit类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showComponents
/**
*
* @return string
*/
public function showComponents()
{
$html = '';
foreach (KitComponent::getAllByCriteria('kitId=?', array($this->kit->getId())) as $index => $kitComponent) {
$html .= $this->getRow($kitComponent->getQty(), $kitComponent->getComponent()->getSku(), $kitComponent->getComponent()->getName(), 'itemRow');
}
return $html;
}
示例2: __construct
public function __construct(database $db, User $user, $menu)
{
$this->db =& $db;
$this->user =& $user;
$this->ajax = Kit::GetParam('ajax', _REQUEST, _BOOL, false);
$this->q = Kit::GetParam('q', _REQUEST, _WORD);
$this->userid = Kit::GetParam('userid', _SESSION, _INT);
$usertypeid = Kit::GetParam('usertype', _SESSION, _INT);
if ($menu == '') {
$this->message = __('No menu provided');
return false;
}
if (!($this->theMenu = $user->MenuAuth($menu))) {
$this->message = __('No permissions for this menu.');
return false;
}
// Set some information about this menu
$this->current = 0;
$this->numberItems = count($this->theMenu);
// We dont want to do 0 items
if ($this->numberItems == 0) {
$this->numberItems = -1;
}
$this->message = $this->numberItems . ' menu items loaded';
return true;
}
示例3: __construct
public function __construct()
{
// Determine if this is an AJAX call or not
$this->ajax = Kit::GetParam('ajax', _REQUEST, _BOOL, false);
// Assume success
$this->success = true;
$this->clockUpdate = false;
$this->focusInFirstInput = true;
$this->appendHiddenSubmit = true;
$this->uniqueReference = '';
$this->buttons = '';
$this->pageSize = 10;
$this->pageNumber = 0;
$this->initialSortColumn = 1;
$this->initialSortOrder = 1;
$this->modal = false;
$this->extra = array();
$this->dialogClass = '';
// Start a DB transaction for all returns from the Web Portal
try {
$dbh = PDOConnect::init();
if (!$dbh->inTransaction()) {
$dbh->beginTransaction();
}
} catch (Exception $e) {
Debug::LogEntry('error', $e->getMessage());
trigger_error(__('Unable to open connection and start transaction'), E_USER_ERROR);
}
return true;
}
示例4: Add
public function Add($dataSetId, $heading, $dataTypeId, $listContent, $columnOrder = 0, $dataSetColumnTypeId = 1, $formula = '')
{
Debug::LogEntry('audit', sprintf('IN - DataSetID = %d', $dataSetId), 'DataSetColumn', 'Add');
try {
$dbh = PDOConnect::init();
// Is the column order provided?
if ($columnOrder == 0) {
$SQL = "";
$SQL .= "SELECT IFNULL(MAX(ColumnOrder), 1) AS ColumnOrder ";
$SQL .= " FROM datasetcolumn ";
$SQL .= "WHERE datasetID = :datasetid ";
$sth = $dbh->prepare($SQL);
$sth->execute(array('datasetid' => $dataSetId));
if (!($row = $sth->fetch())) {
return $this->SetError(25005, __('Could not determine the Column Order'));
}
$columnOrder = Kit::ValidateParam($row['ColumnOrder'], _INT);
}
// Insert the data set column
$SQL = "INSERT INTO datasetcolumn (DataSetID, Heading, DataTypeID, ListContent, ColumnOrder, DataSetColumnTypeID, Formula) ";
$SQL .= " VALUES (:datasetid, :heading, :datatypeid, :listcontent, :columnorder, :datasetcolumntypeid, :formula) ";
$sth = $dbh->prepare($SQL);
$sth->execute(array('datasetid' => $dataSetId, 'heading' => $heading, 'datatypeid' => $dataTypeId, 'listcontent' => $listContent, 'columnorder' => $columnOrder, 'datasetcolumntypeid' => $dataSetColumnTypeId, 'formula' => $formula));
$id = $dbh->lastInsertId();
Debug::LogEntry('audit', 'Complete', 'DataSetColumn', 'Add');
return $id;
} catch (Exception $e) {
Debug::LogEntry('error', $e->getMessage());
return $this->SetError(25005, __('Could not add DataSet Column'));
}
}
示例5: handle_form_data
protected function handle_form_data($file, $index)
{
// Handle form data, e.g. $_REQUEST['description'][$index]
// Link the file to the module
$name = $_REQUEST['name'][$index];
$duration = $_REQUEST['duration'][$index];
$layoutId = Kit::GetParam('layoutid', _REQUEST, _INT);
$type = Kit::GetParam('type', _REQUEST, _WORD);
Debug::LogEntry('audit', 'Upload complete for Type: ' . $type . ' and file name: ' . $file->name . '. Name: ' . $name . '. Duration:' . $duration);
// We want to create a module for each of the uploaded files.
// Do not pass in the region ID so that we only assign to the library and not to the layout
try {
$module = ModuleFactory::createForLibrary($type, $layoutId, $this->options['db'], $this->options['user']);
} catch (Exception $e) {
$file->error = $e->getMessage();
exit;
}
// We want to add this item to our library
if (!($storedAs = $module->AddLibraryMedia($file->name, $name, $duration, $file->name))) {
$file->error = $module->GetErrorMessage();
}
// Set new file details
$file->storedas = $storedAs;
// Delete the file
@unlink($this->get_upload_path($file->name));
}
示例6: __construct
function __construct(database $db, user $user)
{
$this->db =& $db;
$this->user =& $user;
$this->layoutid = Kit::GetParam('layoutid', _REQUEST, _INT);
// Include the layout data class
include_once "lib/data/layout.data.class.php";
//if we have modify selected then we need to get some info
if ($this->layoutid != '') {
// get the permissions
Debug::LogEntry('audit', 'Loading permissions for layoutid ' . $this->layoutid);
$this->auth = $user->LayoutAuth($this->layoutid, true);
if (!$this->auth->view) {
trigger_error(__("You do not have permissions to view this layout"), E_USER_ERROR);
}
$sql = " SELECT layout, description, userid, retired, tags, xml FROM layout ";
$sql .= sprintf(" WHERE layoutID = %d ", $this->layoutid);
if (!($results = $db->query($sql))) {
trigger_error($db->error());
trigger_error(__("Cannot retrieve the Information relating to this layout. The layout may be corrupt."), E_USER_ERROR);
}
if ($db->num_rows($results) == 0) {
$this->has_permissions = false;
}
while ($aRow = $db->get_row($results)) {
$this->layout = Kit::ValidateParam($aRow[0], _STRING);
$this->description = Kit::ValidateParam($aRow[1], _STRING);
$this->retired = Kit::ValidateParam($aRow[3], _INT);
$this->tags = Kit::ValidateParam($aRow[4], _STRING);
$this->xml = $aRow[5];
}
}
}
示例7: ValidateQuestion
public function ValidateQuestion($questionNumber, $response)
{
switch ($questionNumber) {
case 0:
if (Kit::ValidateParam($response, _BOOL)) {
$this->a[0] = "Protected";
} else {
$this->a[0] = "Off";
}
return true;
case 1:
$this->a[1] = Kit::ValidateParam($response, _INT, 30);
return true;
case 2:
$this->a[2] = Kit::ValidateParam($response, _INT, 30);
return true;
case 3:
$this->a[3] = Kit::ValidateParam($response, _BOOL);
return true;
case 4:
// TODO: Teach Kit how to validate email addresses?
$this->a[4] = Kit::ValidateParam($response, _PASSWORD);
return true;
case 5:
// TODO: Teach Kit how to validate email addresses?
$this->a[5] = Kit::ValidateParam($response, _PASSWORD);
return true;
case 6:
$this->a[6] = Kit::ValidateParam($response, _INT, 12);
return true;
}
return false;
}
示例8: displayPage
function displayPage()
{
$db =& $this->db;
$user =& $this->user;
$error = Kit::GetParam('ErrorMessage', _SESSION, _HTMLSTRING, __('Unknown Error'));
Theme::Set('ErrorMessage', $error);
Theme::Render('error');
}
示例9: displayPage
function displayPage()
{
$db =& $this->db;
$user =& $this->user;
$error = Kit::GetParam('ErrorMessage', _SESSION, _HTMLSTRING, __('Unknown Error'));
echo __('There has been an application error.');
echo $error;
exit;
}
示例10: ValidateQuestion
public function ValidateQuestion($questionNumber, $response)
{
switch ($questionNumber) {
case 0:
$this->a[0] = Kit::ValidateParam($response, _BOOL);
return true;
}
return false;
}
示例11: coreStop
public static function coreStop($message)
{
$title = 'Oops';
$error = \Kit::translateSystemError($message);
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) and $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
\Components\XHR::returnError($error);
}
exit(include KIT_CORE . '/Etc/SystemTpl/Exception.php');
}
示例12: InitLocale
/**
* Gets and Sets the Local
* @return
*/
public static function InitLocale()
{
$localeDir = 'locale';
$default = Config::GetSetting('DEFAULT_LANGUAGE');
global $transEngine;
global $stream;
//Debug::LogEntry('audit', 'IN', 'TranslationEngine', 'InitLocal');
// Try to get the local firstly from _REQUEST (post then get)
$lang = Kit::GetParam('lang', _REQUEST, _WORD, '');
// Build an array of supported languages
$supportedLangs = scandir($localeDir);
if ($lang != '') {
// Set the language
Debug::LogEntry('audit', 'Set the Language from REQUEST [' . $lang . ']', 'TranslationEngine', 'InitLocal');
// Is this language supported?
// if not just use the default (eb_GB).
if (!in_array($lang . '.mo', $supportedLangs)) {
trigger_error(sprintf('Language not supported. %s', $lang));
// Use the default language instead.
$lang = $default;
}
} else {
$langs = Kit::GetParam('HTTP_ACCEPT_LANGUAGE', $_SERVER, _STRING);
if ($langs != '') {
//Debug::LogEntry('audit', ' HTTP_ACCEPT_LANGUAGE [' . $langs . ']', 'TranslationEngine', 'InitLocal');
$langs = explode(',', $langs);
foreach ($langs as $lang) {
// Remove any quality rating (as we aren't interested)
$rawLang = explode(';', $lang);
$lang = str_replace("-", "_", $rawLang[0]);
if (in_array($lang . '.mo', $supportedLangs)) {
//Debug::LogEntry('audit', 'Obtained the Language from HTTP_ACCEPT_LANGUAGE [' . $lang . ']', 'TranslationEngine', 'InitLocal');
break;
}
// Set lang as the default
$lang = $default;
}
} else {
$lang = $default;
}
}
// We have the language
//Debug::LogEntry('audit', 'Creating new file streamer for '. $localeDir . '/' . $lang . '.mo', 'TranslationEngine', 'InitLocal');
if (!($stream = new CachedFileReader($localeDir . '/' . $lang . '.mo'))) {
trigger_error('Unable to translate this language');
$transEngine = false;
return;
}
$transEngine = new gettext_reader($stream);
}
示例13: audit
/**
* Audit Log
* @param string $entity
* @param int $entityId
* @param string $message
* @param string|object|array $object
*/
public static function audit($entity, $entityId, $message, $object)
{
\Debug::Audit(sprintf('Audit Trail message recorded for %s with id %d. Message: %s', $entity, $entityId, $message));
if (self::$_auditLogStatement == null) {
$dbh = \PDOConnect::newConnection();
self::$_auditLogStatement = $dbh->prepare('
INSERT INTO `auditlog` (logDate, userId, entity, message, entityId, objectAfter)
VALUES (:logDate, :userId, :entity, :message, :entityId, :objectAfter)
');
}
// If we aren't a string then encode
if (!is_string($object)) {
$object = json_encode($object);
}
self::$_auditLogStatement->execute(array('logDate' => time(), 'userId' => \Kit::GetParam('userid', _SESSION, _INT, 0), 'entity' => $entity, 'message' => $message, 'entityId' => $entityId, 'objectAfter' => $object));
}
示例14: UnlinkAllFromMedia
/**
* Unlink all media from the provided media item
* @param int $mediaid The media item to unlink from
*/
public function UnlinkAllFromMedia($mediaid)
{
Debug::LogEntry('audit', 'IN', get_class(), __FUNCTION__);
try {
$dbh = PDOConnect::init();
$mediaid = Kit::ValidateParam($mediaid, _INT, false);
$sth = $dbh->prepare('DELETE FROM `lkmediadisplaygroup` WHERE mediaid = :mediaid');
$sth->execute(array('mediaid' => $mediaid));
return true;
} catch (Exception $e) {
Debug::LogEntry('error', $e->getMessage(), get_class(), __FUNCTION__);
if (!$this->IsError()) {
$this->SetError(1, __('Unknown Error'));
}
return false;
}
}
示例15: LinkEveryone
/**
* Links everyone to the layout specified
* @param <type> $layoutId
* @param <type> $view
* @param <type> $edit
* @param <type> $del
* @return <type>
*/
public function LinkEveryone($dataSetId, $view, $edit, $del)
{
Debug::LogEntry('audit', 'IN', 'DataSetGroupSecurity', 'LinkEveryone');
try {
$dbh = PDOConnect::init();
// Get the Group ID for Everyone
$sth = $dbh->prepare('SELECT GroupID FROM `group` WHERE IsEveryone = 1');
$sth->execute();
if (!($row = $sth->fetch())) {
throw new Exception('Missing Everyone group');
}
// Link
return $this->Link($dataSetId, Kit::ValidateParam($row['GroupID'], _INT), $view, $edit, $del);
} catch (Exception $e) {
Debug::LogEntry('error', $e->getMessage());
return $this->SetError(25024, __('Could not Link DataSet to Group'));
}
}