code
stringlengths 52
7.75k
| docs
stringlengths 1
5.85k
|
---|---|
public function verify($token, $authyId, $force = false, $action = null): Response
{
// Prepare required variables
$url = $this->api."verify/{$token}/{$authyId}";
$params = $this->params + ['query' => ['force' => $force ? 'true' : 'false', 'action' => $action]];
// Verify Authy token
return new Response($this->http->get($url, $params));
}
|
Verify the given token for the given Authy user.
@param int $token
@param int $authyId
@param bool $force
@param string|null $action
@return \Rinvex\Authy\Response
|
public function register($email, $cellphone, $countryCode, $sendInstallLink = true): Response
{
// Prepare required variables
$url = $this->api.'users/new';
$params = $this->params + [
'form_params' => [
'send_install_link_via_sms' => (bool) $sendInstallLink,
'user' => [
'email' => $email,
'cellphone' => preg_replace('/[^0-9]/', '', $cellphone),
'country_code' => $countryCode,
],
],
];
// Register Authy user, and return response
return new Response($this->http->post($url, $params));
}
|
Register a new Authy user.
@param string $email
@param string $cellphone
@param string $countryCode
@param bool $sendInstallLink
@return \Rinvex\Authy\Response
|
public function registerActivity($authyId, $type, $data, $ip = null): Response
{
// Prepare required variables
$url = $this->api."users/{$authyId}/register_activity";
$params = $this->params + ['form_params' => ['type' => $type, 'data' => $data, 'user_ip' => $ip]];
// Register Authy user activity, and return response
return new Response($this->http->post($url, $params));
}
|
Register the given user activity.
@param int $authyId
@param string $type
@param string $data
@param string|null $ip
@return \Rinvex\Authy\Response
|
public function status($authyId, $ip = null): Response
{
// Prepare required variables
$url = $this->api."users/{$authyId}/status";
$params = $this->params + ['query' => ['user_ip' => $ip]];
// Return Authy user status
return new Response($this->http->get($url, $params));
}
|
Get status of the given user.
@param int $authyId
@param string|null $ip
@return \Rinvex\Authy\Response
|
public function delete($authyId, $ip = null): Response
{
// Prepare required variables
$url = $this->api."users/{$authyId}/delete";
$params = $this->params + ['form_params' => ['ip' => $ip]];
// Delete Authy user, and return response
return new Response($this->http->post($url, $params));
}
|
Delete the given Authy user.
@param int $authyId
@param string|null $ip
@return \Rinvex\Authy\Response
|
private function get(string $name){
$method = 'magic_get_'.$name;
return \method_exists($this, $method) ? $this->$method() : null;
}
|
@param string $name
@return mixed|null
|
private function set(string $name, $value):void{
$method = 'magic_set_'.$name;
if(\method_exists($this, $method)){
$this->$method($value);
}
}
|
@param string $name
@param $value
@return void
|
public function searchByKey(string $dotKey){
foreach($this->iterator as $v){
if($this->getPath() === $dotKey){
return $v;
}
}
return null;
}
|
@param string $dotKey
@return mixed
|
public function searchByValue($value):array{
$matches = [];
foreach($this->iterator as $v){
if($v === $value){
$matches[$this->getPath()] = $value;
}
}
return $matches;
}
|
@param mixed $value
@return array
|
public function isset(string $dotKey):bool{
foreach($this->iterator as $v){
if($this->getPath() === $dotKey){
return true;
}
}
return false;
}
|
@param string $dotKey
@return bool
|
protected function getDetail($detail)
{
$fromDetails = $this->docvertDetails[$detail];
if ($fromDetails) {
return $fromDetails;
}
$fromConfig = $this->config()->get($detail);
if ($fromConfig) {
return $fromConfig;
}
$fromEnv = Environment::getEnv('DOCVERT_' . strtoupper($detail));
if ($fromEnv) {
return $fromEnv;
}
}
|
Retrieves detail in priority order from
1. local instance field
2. Config
3. Environment
@param string $detail key name for detail
@return string the value for that key
|
public function upload(HTTPRequest $request)
{
if ($this->isDisabled() || $this->isReadonly()) {
return $this->httpError(403);
}
// Protect against CSRF on destructive action
$token = $this->getForm()->getSecurityToken();
if (!$token->checkRequest($request)) {
return $this->httpError(400);
}
$tmpfile = $request->postVar('Upload');
// Check if the file has been uploaded into the temporary storage.
if (!$tmpfile) {
$return = [
'error' => _t(
'SilverStripe\\AssetAdmin\\Forms\\UploadField.FIELDNOTSET',
'File information not found'
)
];
} else {
$return = [
'name' => $tmpfile['name'],
'size' => $tmpfile['size'],
'type' => $tmpfile['type'],
'error' => $tmpfile['error']
];
}
if (!$return['error']) {
// Get options for this import.
$splitHeader = (int)$request->postVar('SplitHeader');
$keepSource = (bool)$request->postVar('KeepSource');
$chosenFolderID = (int)$request->postVar('ChosenFolderID');
$publishPages = (bool)$request->postVar('PublishPages');
$includeTOC = (bool)$request->postVar('IncludeTOC');
// Process the document and write the page.
$preservedDocument = null;
if ($keepSource) {
$preservedDocument = $this->preserveSourceDocument($tmpfile, $chosenFolderID);
}
$importResult = $this->importFromPOST($tmpfile, $splitHeader, $publishPages, $chosenFolderID);
if (is_array($importResult) && isset($importResult['error'])) {
$return['error'] = $importResult['error'];
} elseif ($includeTOC) {
$this->writeTOC($publishPages, $keepSource ? $preservedDocument : null);
}
}
$response = HTTPResponse::create(Convert::raw2json([$return]));
$response->addHeader('Content-Type', 'application/json');
return $response;
}
|
Process the document immediately upon upload.
|
protected function preserveSourceDocument($tmpfile, $chosenFolderID = null)
{
$upload = Upload::create();
$file = File::create();
$upload->loadIntoFile($tmpfile, $file, $chosenFolderID);
$page = $this->form->getRecord();
$page->ImportedFromFileID = $file->ID;
$page->write();
return $file;
}
|
Preserves the source file by copying it to a specified folder.
@param $tmpfile Temporary file data structure.
@param int $chosenFolderID Target folder.
@return File Stored file.
|
protected function writeContent($subtitle, $subdoc, $subnode, $sort = null, $publishPages = false)
{
$record = $this->form->getRecord();
if ($subtitle) {
// Write the chapter page to a subpage.
$page = DataObject::get_one(
'Page',
sprintf('"Title" = \'%s\' AND "ParentID" = %d', $subtitle, $record->ID)
);
if (!$page) {
$page = Page::create();
$page->ParentID = $record->ID;
$page->Title = $subtitle;
}
unset($this->unusedChildren[$page->ID]);
file_put_contents(ASSETS_PATH . '/index-' . $sort . '.html', $this->getBodyText($subdoc, $subnode));
if ($sort) {
$page->Sort = $sort;
}
$page->Content = $this->getBodyText($subdoc, $subnode);
$page->write();
if ($publishPages) {
$page->publishRecursive();
}
} else {
// Write to the master page.
$record->Content = $this->getBodyText($subdoc, $subnode);
$record->write();
if ($publishPages) {
$record->publishRecursive();
}
}
}
|
Used only when writing the document that has been split by headers.
Can write both to the chapter pages as well as the master page.
@param string $subtitle Title of the chapter - if missing, it will write to the master page.
@param $subdoc
@param $subnode
@param int $sort Order of the chapter page.
@param $publishPages Whether to publish the resulting child/master pages.
|
private function init()
{
if ($this->init) {
return;
}
$this->init = true;
session_cache_limiter("");
session_set_cookie_params($this->cookie->getLifetime(), $this->cookie->getPath(), $this->cookie->getDomain(), $this->cookie->isSecure(), $this->cookie->isHttpOnly());
session_name($this->name);
if ($this->id !== "") {
session_id($this->id);
}
session_start([
"read_and_close" => true,
]);
/**
* If the cookie has a specific lifetime (not unlimited)
* then ensure it is extended on each use of the session.
*/
if ($this->cookie->getLifetime() > 0) {
$expires = time() + $this->cookie->getLifetime();
setcookie($this->name, session_id(), $expires, $this->cookie->getPath(), $this->cookie->getDomain(), $this->cookie->isSecure(), $this->cookie->isHttpOnly());
}
# Grab the sessions data to respond to get()
$this->data = $_SESSION;
# Grab session ID
$this->id = session_id();
}
|
Ensure the session data is loaded into cache.
@return void
|
public function regenerate()
{
$this->init();
# Generate a new session
session_start();
session_regenerate_id();
# Get the newly generated ID
$this->id = session_id();
# Remove the lock from the session file
session_write_close();
return $this->id;
}
|
Update the current session id with a newly generated one.
@return string The new session ID
|
public function get(string $key)
{
$this->init();
if (!array_key_exists($key, $this->data)) {
return;
}
return $this->data[$key];
}
|
Get a value from the session data cache.
@param string $key The name of the name to retrieve
@return mixed
|
public function destroy(): SessionInterface
{
$this->init();
# Start the session up, but ignore the error about headers already being sent
@session_start();
# Clear the session data from the server
session_destroy();
# Clear the cookie so the client knows the session is gone
setcookie($this->name, "", time() - 86400, $this->cookie->getPath(), $this->cookie->getDomain(), $this->cookie->isSecure(), $this->cookie->isHttpOnly());
# Reset the session data
$this->init = false;
$this->data = [];
return $this;
}
|
Tear down the session and wipe all its data.
@return SessionInterface
|
public static function mapAttributes($attributes)
{
return ' '.join(' ', array_map(
function ($sKey) use ($attributes) {
return is_bool($attributes[$sKey]) ? ($attributes[$sKey] ? $sKey : '') : $sKey.'="'.$attributes[$sKey].'"';
}, array_keys($attributes)
));
}
|
html render function
@param array $attributes
@return string
|
public function delete(string ...$keys): SessionInterface
{
foreach ($keys as $key) {
$this->session->remove($key);
}
return $this;
}
|
Unset a value within session data.
@param string ...$keys All the keys to remove from the session
@return SessionInterface
|
public static function mapAttributes($attributes)
{
return ' '.implode(' ', array_map(
function ($sKey) use ($attributes) {
return is_bool($attributes[$sKey]) ? ($attributes[$sKey] ? $sKey : '') : $sKey.'="'.$attributes[$sKey].'"';
}, array_keys($attributes)
));
}
|
html render function
@param array $attributes
@return string
|
public static function theadFormatter($thead, $rowspan = 1)
{
$html = '<tr>';
foreach ($thead as $v) {
if ($rowspan > 1 && !isset($v['colspan'])) {
$v['rowspan'] = $rowspan;
}
$attr = array_intersect_key($v, array_flip(['class', 'colspan', 'rowspan']));
$html .= '<th'.Helper::mapAttributes($attr).'>'.(isset($v['title']) ? $v['title'] : '').'</th>';
}
$html .= '</tr>';
return $html;
}
|
Thead formatter
@param array $thead
@return string
|
public static function formatOn($on, $r = '')
{
if (isset($on[0]) && is_array($on[0])) {
foreach ($on as $on2) {
$r = self::formatOn($on2, $r);
}
} else {
$on2 = array_keys($on);
$r .= (!empty($r) ? ' AND ' : '').'`'.key($on).'`.`'.current($on).'` = `'.next($on2).'`.`'.next($on).'`';
}
return $r;
}
|
SQL rendering for JOIN ON
@param array $on
@param string $r
@return string
|
public static function arrayToCsv($array, $header_row = true, $col_sep = ",", $row_sep = "\n", $qut = '"')
{
if (!is_array($array) || !isset($array[0]) || !is_array($array[0])) {
return false;
}
$output = '';
if ($header_row) {
foreach ($array[0] as $key => $val) {
$key = str_replace($qut, "$qut$qut", $key);
$output .= "$col_sep$qut$key$qut";
}
$output = substr($output, 1)."\n";
}
foreach ($array as $key => $val) {
$tmp = '';
foreach ($val as $cell_key => $cell_val) {
$cell_val = str_replace($qut, "$qut$qut", $cell_val);
$tmp .= "$col_sep$qut$cell_val$qut";
}
$output .= substr($tmp, 1).$row_sep;
}
return $output;
}
|
Convert an array in a string CSV
@param array $array
@param bool $header_row
@param string $col_sep
@param string $row_sep
@param string $qut
@return string
|
public static function fromRuleSet(RuleSet $ruleSet, array $overrideRules = [])
{
if (\PHP_VERSION_ID < $ruleSet->targetPhpVersion()) {
throw new \RuntimeException(\sprintf(
'Current PHP version "%s is less than targeted PHP version "%s".',
\PHP_VERSION_ID,
$ruleSet->targetPhpVersion()
));
}
$config = new Config($ruleSet->name());
$config->setRiskyAllowed(true);
$config->setRules(\array_merge(
$ruleSet->rules(),
$overrideRules
));
return $config;
}
|
Creates a configuration based on a rule set.
@param RuleSet $ruleSet
@param array $overrideRules
@throws \RuntimeException
@return Config
|
public static function createFromIni(): CookieInterface
{
$params = session_get_cookie_params();
return (new static())
->withLifetime($params["lifetime"])
->withPath($params["path"])
->withDomain($params["domain"])
->withSecure($params["secure"])
->withHttpOnly($params["httponly"]);
}
|
Create a new instance from the current environment settings.
@return CookieInterface
|
public function getSet(string $key, $default = null, bool $strict = false)
{
# If this key was just submitted via post then store it in the session data
if (isset($_POST[$key])) {
$value = $_POST[$key];
if ($strict || $value) {
$this->set($key, $value);
return $value;
}
}
# If this key is part of the get data then store it in session data
if (isset($_GET[$key])) {
$value = $_GET[$key];
if ($strict || $value) {
$this->set($key, $value);
return $value;
}
}
# Get the current value for this key from session data
$value = $this->get($key);
# If there is no current value for this key then set it to the supplied default
if ($default !== null) {
if (($strict && $value === null) || (!$strict && !$value)) {
$value = $default;
$this->set($key, $value);
}
}
return $value;
}
|
This is a convenience method to prevent having to do several checks/set for all persistent variables.
If the key name has been passed via POST then that value is stored in the session and returned.
If the key name has been passed via GET then that value is stored in the session and returned.
If there is already a value in the session data then that is returned.
If all else fails then the default value is returned.
All checks are truthy/falsy (so a POST value of "0" is ignored), unless the 3rd parameter is set to true.
@param string $key The name of the key to retrieve from session data
@param mixed $default The value to use if the current session value is falsey
@param bool $strict Whether to do strict comparisons or not
@return mixed
|
public function delete(string ...$keys): SessionInterface
{
# Convert the array of keys to key/value pairs
$keyValues = [];
foreach ($keys as $key) {
$keyValues[$key] = null;
}
return $this->set($keyValues);
}
|
Unset a value within session data.
@param string ...$keys All the keys to remove from the session
@return SessionInterface
|
public function clear(): SessionInterface
{
# Get all the current session data
$values = $this->getAll();
# Replace all the values with nulls
$values = array_map(function ($value) {
return null;
}, $values);
# Store all the null values (effectively unsetting the keys)
$this->set($values);
return $this;
}
|
Clear all previously set values.
@return SessionInterface
|
public function getFlash(string $key)
{
$key = $this->flashKey($key);
$value = $this->get($key);
$this->delete($key);
return $value;
}
|
Retrieve a one-time value from the session data.
@param string $key The name of the flash value to retrieve
@return mixed
|
public function setFlash(string $key, $value): SessionInterface
{
$key = $this->flashKey($key);
return $this->set($key, $value);
}
|
Set a one-time value within session data.
@param string $key The name of the flash value to update
@param mixed $value The value to store against the key
@return SessionInterface
|
public static function create($accessToken = '')
{
$client = ClientFactory::create();
$responseTransformer = new ArrayBodyTransformer();
$apiExceptionTransformer = new GuzzleTransformer();
return new Api($client, $responseTransformer, $apiExceptionTransformer, $accessToken);
}
|
@param string|null $accessToken
@throws \InvalidArgumentException
@return Api
|
public function handle(ServerRequestInterface $request): ResponseInterface
{
$storageless = $request->getAttribute(SessionMiddleware::SESSION_ATTRIBUTE);
$session = new Session($storageless);
$request = $request->withAttribute(SessionInterface::class, $session);
return $this->handler->handle($request);
}
|
Wrap the storageless session from the request in our session interface.
@param ServerRequestInterface $request The request to handle
@return ResponseInterface
|
public static function instance($id = 'datatable')
{
$cls = get_called_class();
if (!isset(self::$instance[$id])) {
self::$instance[$id] = new $cls($id);
}
return self::$instance[$id];
}
|
Get a table initialized if exist, else initialize one
@param string $id Id wich permit to identify the table
@return self
|
public function setJsInitParams($params)
{
foreach ($params as $k => $v) {
$this->setJsInitParam($k, $v);
}
return $this;
}
|
Add dataTables.js Init Params
@param array $params Contain dataTables.js Init Params
@return self
|
protected function getColumnIndex($params)
{
if (isset($params['parent'])) {
if (is_array($params['parent']) && isset($params['parent']['parent'])) {
return md5($params['parent'][0]);
}
return md5($params['parent'], true);
}
return ++$this->iThead;
}
|
Return a new/next column index for a new column added
@param array $params MAY contain parent if the table has a complex header
@return mixed A string or an integer
|
protected function setTHead(&$params)
{
$k = $this->getColumnIndex($params);
if (isset($params['parent'])) {
$this->theadChild[] = [
'title' => $params['title'],
'class' => isset($params['className']) ? $params['className'] : null,
'colspan' => 1,
];
$this->thead[$k]['colspan'] = !isset($this->thead[$k]['colspan']) ? 1 : ($this->thead[$k]['colspan']+1);
$this->thead[$k]['title'] = $params['parent'];
$this->header = true;
} else {
if (isset($params['title'])) {
$this->thead[$k]['title'] = $params['title'];
}
if (isset($params['className'])) {
$this->thead[$k]['class'] = $params['className'];
}
}
}
|
Add a new column header
@param array $params 's column
|
protected function setTFoot(&$params)
{
if (isset($params['sFilter'])) {
if (isset($params['sFilter']['type']) && in_array($params['sFilter']['type'], self::$columFilteringParams['type'])) {
$params['sFilter'] = array_merge(self::$columFilteringParams, $params['sFilter']);
$this->individualColumnFiltering = true;
$this->footer = true;
} else {
unset($params['sFilter']);
}
}
}
|
Manage the column tfoot
Normalize sFilter params if exist
@param array $params
|
public function setColumn($params, $show = true)
{
if ($show) {
$this->setTHead($params);
$this->setTFoot($params);
$this->columns[] = $params;
} else {
$this->unsetColumns[] = $params;
}
return $this;
}
|
Add a column to the table
@param array $params Can contain :
$params[$key] = mixed // Properties for Initialization Javascript (see self::$columnParams)
$params['parent'] = string // Permit to have a complex header with a colspan...
// Set the same string to put multiple column under the same th
$params['sFilter'] = array // Permit to add a filtering html input for the column
$params['sFilter']['type'] = string // see self::$columFilteringParams['type']
$params['sFilter']['regex'] = bool //
$params['sFilter']['sql_table'] = string
$params['sFilter']['sql_name'] = string
$params['sFilter']['sqlFilter'] = string // Initial SQL filter
@param bool $show Set false to Add a column to load in the result but wich will not be print
@return self
|
public function setColumns($columns)
{
foreach ($columns as $c) {
$this->setColumn($c, isset($c['show']) ? $c['show'] : true);
}
return $this;
}
|
Add columns to the table
@param array $columns
@return self
|
public function setAjax($ajax)
{
if (is_string($ajax)) {
$ajax = array(
'url' => $ajax,
'type' => 'POST',
);
}
$this->setJsInitParam('ajax', is_array($ajax) || is_object($ajax) ? (object) $ajax : (string) $ajax);
return $this;
}
|
Alias for setJsInitParam('ajax', $ajax)
/!/ Doesn't yet support Custom data get function !
@param mixed $ajax
@return self
|
public function setData($data)
{
if (!isset($data[0])) {
throw new \LogicException('Aucune donnée soumise');
}
$k = array_keys($data[0]); // Check the first key from the first line
$objectize = is_string($k[0]) ? true : false;
$n = count($data);
for ($i = 0;$i<$n;++$i) {
$data[$i] = $objectize ? (object) $data[$i] : $data[$i];
}
$this->setJsInitParam('data', $data);
$this->renderFilterOperators = false;
return $this;
}
|
Alias for setJsInitParam('data', $data);
Permit to set the data in the DataTables Javascript Initialization.
@param array $data
@return self
|
protected function getColumnsForJs()
{
$rColumns = [];
foreach ($this->columns as $column) {
self::removeNotJsOptions($column);
if ($column !== null) {
$rColumns[] = $column;
}
}
return !empty($rColumns) ? $rColumns : null;
}
|
Return columns for js with only JS parameters (remove the other parameters we use in PHP)
@return mixed NULL if there is no column else ARRAY
|
protected static function removeNotJsOptions(&$column)
{
foreach ($column as $k => $v) {
if (!in_array($k, self::$columnParams)) {
unset($column[$k]);
}
}
}
|
Format column for javascript : only Keep the required options for columns and convert to object.
@param array $column
|
public function getJavascript()
{
if (!empty($this->columns)) {
$this->setJsInitParam('columns', $this->getColumnsForJs());
}
$js = 'var '.$this->tableName.' = $("#'.$this->tableName.'").dataTable('."\n"
.(!empty($this->jsInitParameters) ? PHPToJS::render((object) $this->jsInitParameters) : '')."\n"
.');'."\n";
$js .= $this->getJavascriptSearchPart();
return $js;
}
|
Return javascript string to activate table
@return string
|
protected function getJavascriptSearchPart()
{
if (!$this->individualColumnFiltering) {
return '';
}
$js = 'var '.$this->tableName.'Api = '.$this->tableName.'.api(true);'."\n"
.'$("#'.$this->tableName.' tfoot th").each( function(colI) {'."\n"
.'$(".sSearch", this).on("keyup change", function (e) {'."\n"
.($this->isServerSide() ? ' if ( e.keyCode == 13 ) {'."\n" : '')
.' '.$this->tableName.'Api.column( colI ).search('
.' '.($this->renderFilterOperators ? '( this.tagName != "INPUT" || this.value == \'\' ? \'\' : $(this).prev().find("select").val()) + this.value ' : ' this.value ')
.' ).draw();'."\n"
.($this->isServerSide() ? ' }'."\n" : '')
.'});'."\n"
.'});'."\n";
return $js;
}
|
Generate the javascript relative to the individual column filtering
@return string
|
public function getHtml($tAttributes = [])
{
$tAttributes['id'] = $this->tableName.(isset($tAttributes['id']) ? ' '.$tAttributes['id'] : '');
$html = '<table'.Helper::mapAttributes($tAttributes).'>';
if ($this->header === true) {
$html .= '<thead>';
$html .= Helper::theadFormatter($this->thead, 2);
if (isset($this->theadChild)) {
$html .= Helper::theadFormatter($this->theadChild);
}
$html .= '</thead>';
}
if ($this->footer === true) {
$html .= '<tfoot>';
$html .= '<tr>';
foreach ($this->columns as $k => $v) {
$html .= '<th>'.(isset($v['sFilter']) ? $this->renderFilter($v) : '').'</th>'; //'.(isset($v->className)?' class="'.$v->className.'"':'').'
// Ajouter un input si $v contient un array search ///// A détailler
}
$html .= '</tr>';
$html .= '</tfoot>';
}
$html .= '</table>';
return $html;
}
|
Return html table (min <table id=datatable></table>)
@param array $tAttributes To add attributes to the <table> eg. : class=>table-green
|
protected function formatOption($name, $value, $label)
{
return '<option value="'.$value.'"'
.(isset($this->filters[$name]) && strpos($this->filters[$name], $value) === 0 ? ' selected' : '')
.'>'.(isset($label) ? $label : $value).'</option>';
}
|
Render option for select
@param string $name
@param string $value
@param string $label
@return string
|
public function setFrom($table, $alias = null)
{
$this->table = $table;
$this->aliasTable = $alias === null ? $table : $alias;
return $this;
}
|
Set the mysql table to request
@param string $table
@param string $alias
@return self
|
public function setJoin($table, $on, $join = 'LEFT JOIN', $duplicate = false)
{
$this->join[] = $join.' '.$table.' ON '.Helper::formatOn($on);
if ($duplicate !== false) {
$this->patchDuplicateRow['pKey'] = $duplicate[0];
if (is_array($duplicate[1])) {
$this->patchDuplicateRow['columns'] = isset($this->patchDuplicateRow['columns']) ? array_merge($this->patchDuplicateRow['columns'], $duplicate[1]) : $duplicate[1];
} else {
$this->patchDuplicateRow['columns'][] = $duplicate[1];
}
}
return $this;
}
|
Join data from other tables
@param string $table .
@param array $on Must contains two elements like key:sql_table => value:sql_column
@param string $join .
@param array $duplicate 0 Contain a column id... Generally the same that on ON
1 Contain column or columns
@return self
|
public function setGroupBy($column)
{
$this->groupBy = (isset($this->groupBy) ? $this->groupBy.',' : '').$column;
return $this;
}
|
Group by a SQL column
@param string $column
@return self
|
protected function dataOutput($data)
{
$out = [];
$data = array_values($data); // Reset keys
for ($i = 0, $ien = count($data); $i<$ien; ++$i) {
$row = [];
for ($j = 0, $jen = count($this->columns); $j<$jen; ++$j) {
$column = $this->columns[$j];
if (isset($column['formatter'])) {
if (isset($column['data']) || isset($column['sql_name'])) {
$row[ isset($column['data']) ? $column['data'] : $j ] = call_user_func($column['formatter'], $data[$i][ self::fromSQLColumn($column) ], $data[$i], $column);
} else {
$row[ $j ] = call_user_func($column['formatter'], $data[$i]);
}
} else {
// Compatibility with the json .
// if preg_match('#\.#', $column['data']) explode ('.', $colum['data'])...
if (isset($column['data']) || isset($column['sql_name'])) {
$row[ isset($column['data']) ? $column['data'] : $j ] = $data[$i][ self::fromSQLColumn($column) ];
} else {
$row[ $j ] = '';
}
}
}
$out[] = $row;
}
return $out;
}
|
Create the data output array for the DataTables rows
@param array $data Data from the SQL get
@return array Formatted data in a row based format
|
public function generateSQLRequest(array $dtRequest)
{
$this->request = $dtRequest;
$limit = $this->limit();
$order = $this->order();
$where = self::where($this->filters());
$iWhere = self::where($this->initFilters());
$join = $this->join();
$having = !empty($this->having) ? ' HAVING '.$this->having : '';
$from = $this->from();
$groupBy = $this->groupBy();
$columns = [];
foreach ($this->columns as $c) {
if (isset($c['data']) || isset($c['sql_name'])) {
$columns[] = $this->toSQLColumn($c);
}
}
foreach ($this->unsetColumns as $c) {
$columns[] = $this->toSQLColumn($c);
}
$select = ($this->counters ? 'SQL_CALC_FOUND_ROWS ' : '').implode(',', $columns);
return [
'data' => 'SELECT '.$select.$from.$join.$where.$groupBy.$having.$order.$limit.';',
'recordsFiltered' => $this->counters ? 'SELECT FOUND_ROWS() count;' : '',
'recordsTotal' => $this->counters ? $this->recordsTotal($from.$join.$iWhere) : '',
];
}
|
Generate the SQL queries (optimized for MariaDB/MySQL) to execute.
@param array $dtRequest Request send by DataTables.js ($_GET or $_POST)
@return array SQL queries to execute (keys: data, recordsFiltered, recordsTotal)
|
protected function limit()
{
if (isset($this->request['start']) && $this->request['length'] != -1) {
return ' LIMIT '.intval($this->request['start']).','.intval($this->request['length']);
}
}
|
Paging : Construct the LIMIT clause for server-side processing SQL query
@return string SQL limit clause
|
protected function order()
{
$order = '';
if (isset($this->request['order']) && count($this->request['order'])) {
$orderBy = [];
for ($i = 0, $ien = count($this->request['order']);$i<$ien;$i++) {
$columnIdx = intval($this->request['order'][$i]['column']);
$column = $this->columns[$columnIdx];
if (!isset($column['orderable']) || $column['orderable'] === true) {
$orderBy[] = $this->toSQLColumn($column, 2).' '.(!isset($this->request['order'][$i]['dir']) || $this->request['order'][$i]['dir'] === 'asc' ? 'ASC' : 'DESC');
}
}
$order = ' ORDER BY '.implode(', ', $orderBy);
}
return $order;
}
|
Ordering : Construct the ORDER BY clause for server-side processing SQL query
@return string SQL order by clause
|
protected function filters()
{
$where = $this->initFilters();
$gf = $this->globalFilter();
$where .= (empty($where) ? $gf : (empty($gf) ? '' : ' AND '.$gf));
$gf = $this->individualColumnFilters();
$where .= (empty($where) ? $gf : (empty($gf) ? '' : ' AND '.$gf));
return $where;
}
|
Searching/Filtering : Construct the WHERE clause for server-side processing SQL query.
@return string
|
protected function initFilters()
{
$initColumnSearch = $this->initColumnSearch;
foreach ($this->columns as $c) {
if (isset($c['sqlFilter'])) {
$where_condition = $this->generateSQLColumnFilter($this->toSQLColumn($c, 2), $c['sqlFilter']);
if (!$this->setHaving($where_condition, $c)) {
$initColumnSearch[] = $this->generateSQLColumnFilter($this->toSQLColumn($c, 2), $c['sqlFilter']);
}
}
}
return implode(' AND ', $initColumnSearch);
}
|
SQL Rendering for the initial filters set
@return string SQL Part Query
|
public function globalFilter()
{
$globalSearch = [];
if (isset($this->request['search']) && !empty($this->request['search']['value'])) {
for ($i = 0, $ien = count($this->request['columns']); $i<$ien; $i++) {
if (self::isSearchable($this->columns[$i])) {
$where_condition = $this->toSQLColumn($this->columns[$i], 2).' LIKE '.$this->pdoLink->quote('%'.$this->request['search']['value'].'%');
if (!$this->setHaving($where_condition, $this->columns[$i])) {
$globalSearch[] = $where_condition;
}
}
}
}
return empty($globalSearch) ? '' : '('.implode(' OR ', $globalSearch).')';
}
|
SQL Rendering for the global search
@return string SQL Part Query
|
protected function individualColumnFilters()
{
$columnSearch = [];
if (isset($this->individualColumnFiltering)) {
$this->sRangeSeparator = isset($this->sRangeSeparator) ? $this->sRangeSeparator : '~';
for ($i = 0, $ien = count($this->columns); $i<$ien; $i++) {
if (self::isSearchable($this->columns[$i]) && !empty($this->request['columns'][$i]['search']['value'])) {
$search_value = trim($this->request['columns'][$i]['search']['value']);
$key = $this->toSQLColumn($this->columns[$i], 2, true);
$where_condition = $this->generateSQLColumnFilter($key, $search_value);
if (!$this->setHaving($where_condition, $this->columns[$i])) {
$columnSearch[] = $where_condition;
}
}
}
}
return implode(' AND ', $columnSearch);
}
|
SQL Rendering for the invidividual column filters
@return string
|
protected function generateSQLColumnFilter($column, $search_value)
{
return self::_generateSQLColumnFilter($column, $search_value, $this->pdoLink, isset($this->sRangeSeparator) ? $this->sRangeSeparator : '~');
}
|
Generate the filter for a column
@param string $column
@param string $search_value
@return string
|
protected function toSQLColumn($column, $onlyAlias = 0, $filter = false)
{
if (!isset($column['sql_name']) && !isset($column['data'])) {
self::sendFatal('Houston, we have a problem with one of your column : can\'t draw it SQL name because it don\'t have data or sql_name define.'."\n".json_encode($column));
}
if ($filter && isset($column['sFilter']) && isset($column['sFilter']['sql_name'])) {
return $this->toSQLColumn($column['sFilter'], $onlyAlias, false);
}
$quote = !isset($column['protect_sql']) || $column['protect_sql'] ? '`' : '';
// Alias ne correspondrait pas à Name ?!!!!
$table = isset($column['sql_table']) ? $column['sql_table'] : $this->aliasTable;
return $onlyAlias === 1 && isset($column['alias']) ?
$column['alias'] :
$quote.$table.$quote.(empty($table) ? '' : '.')
.$quote.(isset($column['sql_name']) ? $column['sql_name'] : $column['data']).$quote
.($onlyAlias === 0 && isset($column['alias']) ? ' AS '.$column['alias'] : '');
}
|
Give a column's sql name
@param array $column
@param int $onlyAlias 0: return sql_table.sql_name AS alias
1: return alias
2: return sql_table.sql_name
@param bool $filter
@return string
|
protected function patchDuplicateRow($d, $pKey, array $columns)
{
$id = $d[$pKey];
if (isset($this->rData[$id])) {
foreach ($columns as $c => $separator) {
$this->rData[$id][$c] .= $separator.$d[$c];
}
} else {
$this->rData[$id] = $d;
}
}
|
To avoid duplicate row when LEFT JOIN if GROUP BY is not set
@param array $d
@param string $pKey
@param array $columns
|
protected function sendData($data, $recordsFiltered, $recordsTotal)
{
$toJson = array(
'draw' => intval($this->request['draw']),
'recordsTotal' => intval($recordsTotal),
'recordsFiltered' => intval($recordsFiltered),
'data' => $this->dataOutput($data), );
if (isset($this->toSend)) {
$toJson = array_merge($this->toSend, $toJson);
}
exit(json_encode($toJson));
}
|
Send the json encoded result for DataTables.js
@param array $data
@param int $recordsFiltered
@param int $recordsTotal
@return json output
|
protected static function sendCsv($data)
{
header("Content-Disposition: attachment; filename=".uniqid('dataExpl').'.csv');
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Description: File Transfer");
exit(Helper::arrayToCsv($data));
}
|
Return the csv
@param array $data
|
public static function sendFatal($error, $toSend = null)
{
$toJson = ['error' => utf8_encode($error)];
if (isset($toSend)) {
$toJson = array_merge($toSend, $toJson);
}
exit(json_encode($toJson));
}
|
Throw a fatal error.
This writes out an error message in a JSON string which DataTables will
see and show to the user in the browser.
@param string $error Message to send to the client
@param array $toSend Others informations to transfer
|
public function setTranslator(\Symfony\Component\Translation\TranslatorInterface $translator)
{
$this->translator = $translator;
return $this;
}
|
@param \Symfony\Component\Translation\TranslatorInterface $translator
@return self
|
protected function trans($text)
{
if (isset($this->translator)) {
return $this->translator->trans('dataTable.'.$text);
}
return $text;
}
|
@param string $text
@return string
|
public static function getInstance(): SessionInterface
{
if (static::$session instanceof SessionInterface) {
return static::$session;
}
if (strlen(static::$name) < 1) {
throw new \Exception("Cannot start session, no name has been specified, you must call Session::name() before using this class");
}
static::$session = new SessionInstance(static::$name);
return static::$session;
}
|
Ensure the session instance has been created.
@return SessionInterface
|
public static function getSet(string $key, $default = null, bool $strict = false)
{
return static::getInstance()->getSet($key, $default, $strict);
}
|
This is a convenience method to prevent having to do several checks/set for all persistant variables.
If the key name has been passed via POST then that value is stored in the session and returned.
If the key name has been passed via GET then that value is stored in the session and returned.
If there is already a value in the session data then that is returned.
If all else fails then the default value is returned.
All checks are truthy/falsy (so a POST value of "0" is ignored), unless the 3rd parameter is set to true.
@param string $key The name of the key to retrieve from session data
@param mixed $default The value to use if the current session value is falsy
@param bool $strict Whether to do strict comparisons or not
@return mixed
|
public function createNamespace(string $name): SessionInterface
{
$name = $this->getNamespacedKey($name);
return new SessionNamespace($name, $this->session);
}
|
Create a new namespaced section of this session to avoid clashes.
@param string $name The namespace of the session
@return SessionInterface
|
public function get(string $key)
{
$key = $this->getNamespacedKey($key);
return $this->session->get($key);
}
|
Get a value from the session data cache.
@param string $key The name of the name to retrieve
@return mixed
|
public function getAll(): array
{
$namespace = $this->getNamespace();
$length = mb_strlen($namespace);
$values = [];
$data = $this->session->getAll();
foreach ($data as $key => $val) {
if (mb_substr($key, 0, $length) === $namespace) {
$key = mb_substr($key, $length);
$values[$key] = $val;
}
}
return $values;
}
|
Get all the current session data.
@return array
|
public function set($data, $value = null): SessionInterface
{
if (is_array($data)) {
$newData = [];
foreach ($data as $key => $val) {
$key = $this->getNamespacedKey($key);
$newData[$key] = $val;
}
$data = $newData;
} else {
$data = $this->getNamespacedKey($data);
}
$this->session->set($data, $value);
return $this;
}
|
Set a value within session data.
@param string|array $data Either the name of the session key to update, or an array of keys to update
@param mixed $value If $data is a string then store this value in the session data
@return SessionInterface
|
public function clear(): SessionInterface
{
$values = $this->getAll();
if (count($values) > 0) {
$this->delete(...array_keys($values));
}
return $this;
}
|
Tear down the session and wipe all it's data.
@return SessionInterface
|
public function updateInstances($route, $request)
{
$this->request = $request;
if ($request) {
$this->uri = urldecode($request->path());
}
$this->route = $route;
if ($route) {
$this->action = $route->getActionName();
$actionSegments = Str::parseCallback($this->action, null);
$this->controller = head($actionSegments);
$this->method = last($actionSegments);
}
}
|
Update the route and request instances
@param Route $route
@param Request $request
|
public function checkUri($uris)
{
if (!$this->request) {
return false;
}
foreach ((array)$uris as $uri) {
if ($this->uri == $uri) {
return true;
}
}
return false;
}
|
Check if the URI of the current request matches one of the specific URIs
@param array|string $uris
@return bool
|
public function checkUriPattern($patterns)
{
if (!$this->request) {
return false;
}
foreach ((array)$patterns as $p) {
if (str_is($p, $this->uri)) {
return true;
}
}
return false;
}
|
Check if the current URI matches one of specific patterns (using `str_is`)
@param array|string $patterns
@return bool
|
public function checkQuery($key, $value)
{
if (!$this->request) {
return false;
}
$queryValue = $this->request->query($key);
// if the `key` exists in the query string with the correct value
// OR it exists with any value
// OR its value is an array that contains the specific value
if (($queryValue == $value) || ($queryValue !== null && $value === false) || (is_array($queryValue) && in_array($value,
$queryValue))
) {
return true;
}
return false;
}
|
Check if one of the following condition is true:
+ the value of $value is `false` and the current querystring contain the key $key
+ the value of $value is not `false` and the current value of the $key key in the querystring equals to $value
+ the value of $value is not `false` and the current value of the $key key in the querystring is an array that
contains the $value
@param string $key
@param mixed $value
@return bool
|
public function checkRoute($routeNames)
{
if (!$this->route) {
return false;
}
$routeName = $this->route->getName();
if (in_array($routeName, (array)$routeNames)) {
return true;
}
return false;
}
|
Check if the name of the current route matches one of specific values
@param array|string $routeNames
@return bool
|
public function checkRoutePattern($patterns)
{
if (!$this->route) {
return false;
}
$routeName = $this->route->getName();
if ($routeName == null) {
return in_array(null, $patterns);
}
foreach ((array)$patterns as $p) {
if (str_is($p, $routeName)) {
return true;
}
}
return false;
}
|
Check the current route name with one or some patterns
@param array|string $patterns
@return bool
|
public function checkRouteParam($param, $value)
{
if (!$this->route) {
return false;
}
$paramValue = $this->route->parameter($param);
// If the parameter value is an instance of Model class, we compare $value with the value of
// its primary key.
if (is_a($paramValue, Model::class)) {
return $paramValue->{$paramValue->getKeyName()} == $value;
}
return $paramValue == $value;
}
|
Check if the parameter of the current route has the correct value
@param $param
@param $value
@return bool
|
public function checkAction($actions)
{
if (!$this->action) {
return false;
}
if (in_array($this->action, (array)$actions)) {
return true;
}
return false;
}
|
Return 'active' class if current route action match one of provided action names
@param array|string $actions
@return bool
|
public function checkController($controllers)
{
if (!$this->controller) {
return false;
}
if (in_array($this->controller, (array)$controllers)) {
return true;
}
return false;
}
|
Check if the current controller class matches one of specific values
@param array|string $controllers
@return bool
|
public function register()
{
$this->app->singleton(
'active',
function ($app) {
$instance = new Active($app['router']->getCurrentRequest());
return $instance;
}
);
}
|
Register the service provider.
@return void
|
public function getFileNameVersioned()
{
return static::buildFileNameVersioned($this->strFileName, static::getVersionForFileName($this->intVersionMajor, $this->intVersionMinor, $this->intVersionPatch), $this->strFileType);
}
|
Return the complete versioned filename string for this document.
@return string The complete versioned filename string for this document.
|
public function getFileSize($strUnit, $blnFormatted = false)
{
$doubleFileSize = \Document::convertFileSize($this->intFileSize, self::FILE_SIZE_UNIT_BYTE, $strUnit);
if ($doubleFileSize < 0)
{
throw new \Exception(sprintf('Invalid file size [%s] or unit [%s] for document.', $this->intFileSize, $strKey));
}
if ($blnFormatted)
{
return \Document::formatFileSize($doubleFileSize, $strUnit);
}
return $doubleFileSize;
}
|
Return the file size for the given unit.
@param string $strUnit The file size unit.
@param bool $blnFormatted True if the file size should be returned as formatted string (with unit).
@return mixed The file size for the given unit (as int or formatted as string).
|
public static function formatFileSize($doubleFileSize, $strUnit)
{
$value = number_format($doubleFileSize, 2, $GLOBALS['TL_LANG']['DMS']['file_size_format']['dec_point'], $GLOBALS['TL_LANG']['DMS']['file_size_format']['$thousands_sep']);
if (substr($value, -3) == ($GLOBALS['TL_LANG']['DMS']['file_size_format']['dec_point'] . "00"))
{
$value = substr($value, 0, - 3);
}
return sprintf($GLOBALS['TL_LANG']['DMS']['file_size_format']['text'], $value, $GLOBALS['TL_LANG']['DMS']['file_size_unit'][$strUnit]);
}
|
Utility function to format file size values
@param double $doubleFileSize The file size value.
@param string $strUnit The file size unit.
@return string The formatted file size value.
|
public function generate()
{
if (TL_MODE == 'BE')
{
$objTemplate = new \BackendTemplate('be_wildcard');
$objTemplate->wildcard = '### DOCUMENT MANAGEMENT SYSTEM - LISTING ###';
$objTemplate->title = $this->headline;
$objTemplate->id = $this->id;
$objTemplate->link = $this->name;
$objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
return $objTemplate->parse();
}
return parent::generate();
}
|
Display a wildcard in the back end
@return string
|
private function applyReadPermissionsToCategories(Array $arrCategories)
{
$arrSecureCategories = $arrCategories;
foreach ($arrSecureCategories as $category)
{
if (!$category->isPublished() || ($this->dmsHideEmptyCategories && !$category->hasPublishedDocuments()) || ($this->dmsHideLockedCategories && !$category->isReadableForCurrentMember()))
{
unset($arrSecureCategories[$category->id]);
}
else if ($category->hasSubCategories())
{
$arrSecureSubCategories = $this->applyReadPermissionsToCategories($category->subCategories);
$category->subCategories = $arrSecureSubCategories;
}
}
return $arrSecureCategories;
}
|
Apply the read permissions to the categories.
@param arr $arrCategories The structured array of categories.
@return array Returns a reduced array of categories (depends on the read permissions).
|
public function isPublished()
{
$time = time();
$published = ($this->published && ($this->publicationStart == '' || $this->publicationStart < $time) && ($this->publicationStop == '' || $this->publicationStop > $time));
return $published;
}
|
Return if this category is published.
@return bool True if this category is published.
|
public function shouldPublishDocumentsPerDefault()
{
if ($this->strPublishDocumentsPerDefault == self::PUBLISH_DOCUMENTS_PER_DEFAULT_ENABLE)
{
return true;
}
else if ($this->strPublishDocumentsPerDefault == self::PUBLISH_DOCUMENTS_PER_DEFAULT_INHERIT && $this->hasParentCategory())
{
return $this->parentCategory->shouldPublishDocumentsPerDefault();
}
return false;
}
|
Return if documents uploaded to this category should be published per default.
@return bool If documents uploaded to this category should be published per default or not.
|
public function hasDocumentsInSubCategories()
{
if ($this->hasSubCategories())
{
foreach ($this->arrSubCategories as $subCategory)
{
if ($subCategory->hasDocuments() || $subCategory->hasDocumentsInSubCategories())
{
return true;
}
}
}
return false;
}
|
Return if this category has documents in any of its subcategories.
@return bool True if there are documents in any the subcategories.
|
public function getPublishedDocumentCount()
{
$count = 0;
foreach ($this->arrDocuments as $document)
{
if ($document->isPublished())
{
$count++;
}
}
return $count;
}
|
Get the number of published documents.
@return int The number of published documents.
|
public function isReadableForCurrentMember()
{
if ($this->generalReadPermission == self::GENERAL_READ_PERMISSION_ALL)
{
return true;
}
else if ($this->generalReadPermission == self::GENERAL_READ_PERMISSION_LOGGED_USER && FE_USER_LOGGED_IN)
{
return true;
}
else if ($this->generalReadPermission == self::GENERAL_READ_PERMISSION_CUSTOM && FE_USER_LOGGED_IN)
{
return $this->isAccessibleForCurrentMember(\AccessRight::READ);
}
else if ($this->generalReadPermission == self::GENERAL_READ_PERMISSION_INHERIT && $this->hasParentCategory())
{
return $this->parentCategory->isReadableForCurrentMember();
}
return false;
}
|
Return if this category is readable for the current logged member.
@return bool True if this category is readable for the current logged member.
|
public function isAccessibleForCurrentMember($strAccessRight)
{
if ($this->generalManagePermission == self::GENERAL_MANAGE_PERMISSION_LOGGED_USER && FE_USER_LOGGED_IN)
{
return true;
}
else if ($this->generalManagePermission == self::GENERAL_MANAGE_PERMISSION_CUSTOM && FE_USER_LOGGED_IN)
{
$blnIsAccessible = false;
$arrMemberGroups = deserialize(\FrontendUser::getInstance()->groups);
if (!empty($arrMemberGroups))
{
foreach($this->arrAccessRights as $accessRight)
{
if ($accessRight->isActive() && in_array($accessRight->memberGroup, $arrMemberGroups))
{
$blnIsAccessible = $blnIsAccessible || $accessRight->$strAccessRight;
}
}
}
return $blnIsAccessible;
}
else if ($this->generalManagePermission == self::GENERAL_MANAGE_PERMISSION_INHERIT && $this->hasParentCategory())
{
return $this->parentCategory->isAccessibleForCurrentMember($strAccessRight);
}
return false;
}
|
Return if the current logged member has access with the given right to this category.
@param string $strAccessRight The name of the right.
@return bool True if the current logged member has access with the given right to this category.
|
public function getPath($blnSkipThis)
{
$arrPath = array();
if (!$this->isRootCategory() && $this->hasParentCategory())
{
$arrPath = $this->parentCategory->getPath(false);
}
if (!$blnSkipThis)
{
$arrPath[] = $this;
}
return $arrPath;
}
|
Returns the path from the root node of this category to this category in context of the current structure of categories.
@param bool $blnSkipThis True if this category should be skipped.
@return arr All nodes in the path from the root node to this category.
|
public function getPathNames($blnSkipThis)
{
$arrPath = array();
if (!$this->isRootCategory() && $this->hasParentCategory())
{
$arrPath = $this->parentCategory->getPathNames(false);
}
if (!$blnSkipThis)
{
$arrPath[] = $this->name;
}
return $arrPath;
}
|
Returns the names in the path from the root node of this category to this category in context of the current structure of categories.
@param bool $blnSkipThis True if the name of this category should be skipped.
@return arr All nodes names in the path from the root node to this category.
|
public function getAllowedFileTypes()
{
$arrFileTypesOfParents = array();
if ($this->fileTypesInherit && !$this->isRootCategory() && $this->hasParentCategory())
{
$arrFileTypesOfParents = $this->parentCategory->getAllowedFileTypes();
}
$arrFileTypes = DmsUtils::getUniqueFileTypes($this->fileTypes, $arrFileTypesOfParents);
return $arrFileTypes;
}
|
Returns an array of file types which are allowed to be uploaded into this category.
@return array The array of file types which are allowed.
|
public function isFileTypeAllowed($strFileType, $blnCaseSensitive = false)
{
$arrAllowedFileTypes = $this->getAllowedFileTypes();
if (!$blnCaseSensitive)
{
$strFileType = strtolower($strFileType);
}
return in_array($strFileType, $arrAllowedFileTypes);
}
|
Returns if the given file type is allowed to be uploaded into this category.
@param string $strFileType The file type to be checked.
@param bool $blnCaseSensitive True if checking should be done case sensitive.
@return bool True if the given file type is allowed to be uploaded into this category.
|
public function getDmsTemplates(DataContainer $dc)
{
$intPid = $dc->activeRecord->pid;
if ($this->Input->get('act') == 'overrideAll')
{
$intPid = $this->Input->get('id');
}
return $this->getTemplateGroup('mod_' . $dc->activeRecord->type, $intPid);
}
|
Return all dms templates as array
@param DataContainer
@return array
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.