repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
hiqdev/hipanel-core
src/widgets/combo/InternalObjectCombo.php
InternalObjectCombo.reset
private function reset(): void { $attributes = [ '_primaryFilter' => null, ]; foreach ($attributes as $attribute => $defaultValue) { $this->$attribute = $defaultValue; } }
php
private function reset(): void { $attributes = [ '_primaryFilter' => null, ]; foreach ($attributes as $attribute => $defaultValue) { $this->$attribute = $defaultValue; } }
[ "private", "function", "reset", "(", ")", ":", "void", "{", "$", "attributes", "=", "[", "'_primaryFilter'", "=>", "null", ",", "]", ";", "foreach", "(", "$", "attributes", "as", "$", "attribute", "=>", "$", "defaultValue", ")", "{", "$", "this", "->",...
Reset attributes which may remains from the previous combo-object which leads to incorrect JS configuration.
[ "Reset", "attributes", "which", "may", "remains", "from", "the", "previous", "combo", "-", "object", "which", "leads", "to", "incorrect", "JS", "configuration", "." ]
090eb4b95dd731b338cd661b569f6b9b999f95e4
https://github.com/hiqdev/hipanel-core/blob/090eb4b95dd731b338cd661b569f6b9b999f95e4/src/widgets/combo/InternalObjectCombo.php#L182-L190
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.setObjectName
public function setObjectName($objectName = null) { return parent::setObjectName(is_null($objectName) ? ( empty($this->getRecordIdent()) ? $this->getObjectName() : $this->getRecordIdent().'@'.$this->getObjectName() ) : $objectName); }
php
public function setObjectName($objectName = null) { return parent::setObjectName(is_null($objectName) ? ( empty($this->getRecordIdent()) ? $this->getObjectName() : $this->getRecordIdent().'@'.$this->getObjectName() ) : $objectName); }
[ "public", "function", "setObjectName", "(", "$", "objectName", "=", "null", ")", "{", "return", "parent", "::", "setObjectName", "(", "is_null", "(", "$", "objectName", ")", "?", "(", "empty", "(", "$", "this", "->", "getRecordIdent", "(", ")", ")", "?",...
Set internal Object name @param string $objectName @return string Jméno objektu
[ "Set", "internal", "Object", "name" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L419-L424
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.setupProperty
public function setupProperty($options, $name, $constant = null) { if (array_key_exists($name, $options)) { $this->$name = $options[$name]; } else { if (property_exists($this, $name) && !empty($constant) && defined($constant)) { $this->$name = constant($constant); } } }
php
public function setupProperty($options, $name, $constant = null) { if (array_key_exists($name, $options)) { $this->$name = $options[$name]; } else { if (property_exists($this, $name) && !empty($constant) && defined($constant)) { $this->$name = constant($constant); } } }
[ "public", "function", "setupProperty", "(", "$", "options", ",", "$", "name", ",", "$", "constant", "=", "null", ")", "{", "if", "(", "array_key_exists", "(", "$", "name", ",", "$", "options", ")", ")", "{", "$", "this", "->", "$", "name", "=", "$"...
Set up one of properties @param array $options array of given properties @param string $name name of property to process @param string $constant load default property value from constant
[ "Set", "up", "one", "of", "properties" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L486-L495
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.companyUrlToOptions
public static function companyUrlToOptions($companyUrl) { $urlParts = parse_url($companyUrl); $scheme = isset($urlParts['scheme']) ? $urlParts['scheme'].'://' : ''; $host = isset($urlParts['host']) ? $urlParts['host'] : ''; $port = isset($urlParts['port']) ? ':'.$urlParts['port'] : ''; $path = isset($urlParts['path']) ? $urlParts['path'] : ''; $options['company'] = basename($path); $options['url'] = $scheme.$host.$port; return $options; }
php
public static function companyUrlToOptions($companyUrl) { $urlParts = parse_url($companyUrl); $scheme = isset($urlParts['scheme']) ? $urlParts['scheme'].'://' : ''; $host = isset($urlParts['host']) ? $urlParts['host'] : ''; $port = isset($urlParts['port']) ? ':'.$urlParts['port'] : ''; $path = isset($urlParts['path']) ? $urlParts['path'] : ''; $options['company'] = basename($path); $options['url'] = $scheme.$host.$port; return $options; }
[ "public", "static", "function", "companyUrlToOptions", "(", "$", "companyUrl", ")", "{", "$", "urlParts", "=", "parse_url", "(", "$", "companyUrl", ")", ";", "$", "scheme", "=", "isset", "(", "$", "urlParts", "[", "'scheme'", "]", ")", "?", "$", "urlPart...
Convert companyUrl provided by CustomButton to options array @param string $companyUrl @return array Options
[ "Convert", "companyUrl", "provided", "by", "CustomButton", "to", "options", "array" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L504-L515
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.getConnectionOptions
public function getConnectionOptions() { $conOpts = ['url' => $this->url]; if (empty($this->authSessionId)) { $conOpts ['user'] = $this->user; $conOpts['password'] = $this->password; } else { $conOpts['authSessionId'] = $this->authSessionId; } $company = $this->getCompany(); if (!empty($company)) { $conOpts['company'] = $company; } if (!is_null($this->timeout)) { $conOpts['timeout'] = $this->timeout; } return $conOpts; }
php
public function getConnectionOptions() { $conOpts = ['url' => $this->url]; if (empty($this->authSessionId)) { $conOpts ['user'] = $this->user; $conOpts['password'] = $this->password; } else { $conOpts['authSessionId'] = $this->authSessionId; } $company = $this->getCompany(); if (!empty($company)) { $conOpts['company'] = $company; } if (!is_null($this->timeout)) { $conOpts['timeout'] = $this->timeout; } return $conOpts; }
[ "public", "function", "getConnectionOptions", "(", ")", "{", "$", "conOpts", "=", "[", "'url'", "=>", "$", "this", "->", "url", "]", ";", "if", "(", "empty", "(", "$", "this", "->", "authSessionId", ")", ")", "{", "$", "conOpts", "[", "'user'", "]", ...
Get Current connection options for use in another object @return array usable as second constructor parameter
[ "Get", "Current", "connection", "options", "for", "use", "in", "another", "object" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L522-L539
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.setDataValue
public function setDataValue($columnName, $value) { switch ($columnName) { case 'kod': $value = self::uncode($value); //Alwyas uncode "kod" column break; default: if (is_object($value)) { switch (get_class($value)) { case 'DateTime': $columnInfo = $this->getColumnInfo($columnName); switch ($columnInfo['type']) { case 'date': $value = self::dateToFlexiDate($value); break; case 'datetime': $value = self::dateToFlexiDateTime($value); break; } break; } } $result = parent::setDataValue($columnName, $value); break; } return $result; }
php
public function setDataValue($columnName, $value) { switch ($columnName) { case 'kod': $value = self::uncode($value); //Alwyas uncode "kod" column break; default: if (is_object($value)) { switch (get_class($value)) { case 'DateTime': $columnInfo = $this->getColumnInfo($columnName); switch ($columnInfo['type']) { case 'date': $value = self::dateToFlexiDate($value); break; case 'datetime': $value = self::dateToFlexiDateTime($value); break; } break; } } $result = parent::setDataValue($columnName, $value); break; } return $result; }
[ "public", "function", "setDataValue", "(", "$", "columnName", ",", "$", "value", ")", "{", "switch", "(", "$", "columnName", ")", "{", "case", "'kod'", ":", "$", "value", "=", "self", "::", "uncode", "(", "$", "value", ")", ";", "//Alwyas uncode \"kod\" ...
Set Data Field value @param string $columnName field name @param mixed $value field data value @return bool Success
[ "Set", "Data", "Field", "value" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L600-L626
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.setPrefix
public function setPrefix($prefix) { switch ($prefix) { case 'a': //Access case 'c': //Company case 'u': //User case 'g': //License Groups case 'admin': case 'status': case 'login-logout': $this->prefix = '/'.$prefix.'/'; break; case null: case '': case '/': $this->prefix = ''; break; default: throw new \Exception(sprintf('Unknown prefix %s', $prefix)); } }
php
public function setPrefix($prefix) { switch ($prefix) { case 'a': //Access case 'c': //Company case 'u': //User case 'g': //License Groups case 'admin': case 'status': case 'login-logout': $this->prefix = '/'.$prefix.'/'; break; case null: case '': case '/': $this->prefix = ''; break; default: throw new \Exception(sprintf('Unknown prefix %s', $prefix)); } }
[ "public", "function", "setPrefix", "(", "$", "prefix", ")", "{", "switch", "(", "$", "prefix", ")", "{", "case", "'a'", ":", "//Access", "case", "'c'", ":", "//Company", "case", "'u'", ":", "//User", "case", "'g'", ":", "//License Groups", "case", "'admi...
Set URL prefix @param string $prefix
[ "Set", "URL", "prefix" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L653-L673
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.setFormat
public function setFormat($format) { $result = true; if (($this->debug === true) && !empty($this->evidence) && isset(Formats::$$this->evidence)) { if (array_key_exists($format, array_flip(Formats::$$this->evidence)) === false) { $result = false; } } if ($result === true) { $this->format = $format; $this->updateApiURL(); } return $result; }
php
public function setFormat($format) { $result = true; if (($this->debug === true) && !empty($this->evidence) && isset(Formats::$$this->evidence)) { if (array_key_exists($format, array_flip(Formats::$$this->evidence)) === false) { $result = false; } } if ($result === true) { $this->format = $format; $this->updateApiURL(); } return $result; }
[ "public", "function", "setFormat", "(", "$", "format", ")", "{", "$", "result", "=", "true", ";", "if", "(", "(", "$", "this", "->", "debug", "===", "true", ")", "&&", "!", "empty", "(", "$", "this", "->", "evidence", ")", "&&", "isset", "(", "Fo...
Set communication format. One of html|xml|json|csv|dbf|xls|isdoc|isdocx|edi|pdf|pdf|vcf|ical @param string $format @return boolean format is availble
[ "Set", "communication", "format", ".", "One", "of", "html|xml|json|csv|dbf|xls|isdoc|isdocx|edi|pdf|pdf|vcf|ical" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L683-L697
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.getEvidenceURL
public function getEvidenceURL() { $evidenceUrl = $this->url.$this->prefix.$this->company; $evidence = $this->getEvidence(); if (!empty($evidence)) { $evidenceUrl .= '/'.$evidence; } return $evidenceUrl; }
php
public function getEvidenceURL() { $evidenceUrl = $this->url.$this->prefix.$this->company; $evidence = $this->getEvidence(); if (!empty($evidence)) { $evidenceUrl .= '/'.$evidence; } return $evidenceUrl; }
[ "public", "function", "getEvidenceURL", "(", ")", "{", "$", "evidenceUrl", "=", "$", "this", "->", "url", ".", "$", "this", "->", "prefix", ".", "$", "this", "->", "company", ";", "$", "evidence", "=", "$", "this", "->", "getEvidence", "(", ")", ";",...
Return basic URL for used Evidence @link https://www.flexibee.eu/api/dokumentace/ref/urls/ Sestavování URL @return string Evidence URL
[ "Return", "basic", "URL", "for", "used", "Evidence" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L849-L857
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.evidenceUrlWithSuffix
public function evidenceUrlWithSuffix($urlSuffix) { $evidenceUrl = $this->getEvidenceUrl(); if (!empty($urlSuffix)) { if (($urlSuffix[0] != '/') && ($urlSuffix[0] != ';') && ($urlSuffix[0] != '?')) { $evidenceUrl .= '/'; } $evidenceUrl .= $urlSuffix; } return $evidenceUrl; }
php
public function evidenceUrlWithSuffix($urlSuffix) { $evidenceUrl = $this->getEvidenceUrl(); if (!empty($urlSuffix)) { if (($urlSuffix[0] != '/') && ($urlSuffix[0] != ';') && ($urlSuffix[0] != '?')) { $evidenceUrl .= '/'; } $evidenceUrl .= $urlSuffix; } return $evidenceUrl; }
[ "public", "function", "evidenceUrlWithSuffix", "(", "$", "urlSuffix", ")", "{", "$", "evidenceUrl", "=", "$", "this", "->", "getEvidenceUrl", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "urlSuffix", ")", ")", "{", "if", "(", "(", "$", "urlSuffix"...
Add suffix to Evidence URL @param string $urlSuffix @return string
[ "Add", "suffix", "to", "Evidence", "URL" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L866-L877
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.rawJsonToArray
public function rawJsonToArray($rawJson) { $responseDecoded = json_decode($rawJson, true, 10); $decodeError = json_last_error_msg(); if ($decodeError == 'No error') { if (array_key_exists($this->nameSpace, $responseDecoded)) { $responseDecoded = $responseDecoded[$this->nameSpace]; } } else { $this->addStatusMessage('JSON Decoder: '.$decodeError, 'error'); $this->addStatusMessage($rawJson, 'debug'); } return $responseDecoded; }
php
public function rawJsonToArray($rawJson) { $responseDecoded = json_decode($rawJson, true, 10); $decodeError = json_last_error_msg(); if ($decodeError == 'No error') { if (array_key_exists($this->nameSpace, $responseDecoded)) { $responseDecoded = $responseDecoded[$this->nameSpace]; } } else { $this->addStatusMessage('JSON Decoder: '.$decodeError, 'error'); $this->addStatusMessage($rawJson, 'debug'); } return $responseDecoded; }
[ "public", "function", "rawJsonToArray", "(", "$", "rawJson", ")", "{", "$", "responseDecoded", "=", "json_decode", "(", "$", "rawJson", ",", "true", ",", "10", ")", ";", "$", "decodeError", "=", "json_last_error_msg", "(", ")", ";", "if", "(", "$", "deco...
Convert FlexiBee Response JSON to Array @param string $rawJson @return array
[ "Convert", "FlexiBee", "Response", "JSON", "to", "Array" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L976-L989
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.parseError
public function parseError(array $responseDecoded) { if (array_key_exists('results', $responseDecoded)) { $this->errors = $responseDecoded['results'][0]['errors']; foreach ($this->errors as $errorInfo) { $this->addStatusMessage($errorInfo['message'], 'error'); if (array_key_exists('for', $errorInfo)) { unset($errorInfo['message']); $this->addStatusMessage(json_encode($errorInfo), 'debug'); } } } else { if (array_key_exists('message', $responseDecoded)) { $this->errors = [['message' => $responseDecoded['message']]]; } } return count($this->errors); }
php
public function parseError(array $responseDecoded) { if (array_key_exists('results', $responseDecoded)) { $this->errors = $responseDecoded['results'][0]['errors']; foreach ($this->errors as $errorInfo) { $this->addStatusMessage($errorInfo['message'], 'error'); if (array_key_exists('for', $errorInfo)) { unset($errorInfo['message']); $this->addStatusMessage(json_encode($errorInfo), 'debug'); } } } else { if (array_key_exists('message', $responseDecoded)) { $this->errors = [['message' => $responseDecoded['message']]]; } } return count($this->errors); }
[ "public", "function", "parseError", "(", "array", "$", "responseDecoded", ")", "{", "if", "(", "array_key_exists", "(", "'results'", ",", "$", "responseDecoded", ")", ")", "{", "$", "this", "->", "errors", "=", "$", "responseDecoded", "[", "'results'", "]", ...
Parse error message response @param array $responseDecoded @return int number of errors processed
[ "Parse", "error", "message", "response" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L1062-L1079
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.xml2array
public static function xml2array($xml) { $arr = []; if (!empty($xml)) { if (is_string($xml)) { $xml = simplexml_load_string($xml); } foreach ($xml->attributes() as $a) { $arr['@'.$a->getName()] = strval($a); } foreach ($xml->children() as $r) { if (count($r->children()) == 0) { $arr[$r->getName()] = strval($r); } else { $arr[$r->getName()][] = self::xml2array($r); } } } return $arr; }
php
public static function xml2array($xml) { $arr = []; if (!empty($xml)) { if (is_string($xml)) { $xml = simplexml_load_string($xml); } foreach ($xml->attributes() as $a) { $arr['@'.$a->getName()] = strval($a); } foreach ($xml->children() as $r) { if (count($r->children()) == 0) { $arr[$r->getName()] = strval($r); } else { $arr[$r->getName()][] = self::xml2array($r); } } } return $arr; }
[ "public", "static", "function", "xml2array", "(", "$", "xml", ")", "{", "$", "arr", "=", "[", "]", ";", "if", "(", "!", "empty", "(", "$", "xml", ")", ")", "{", "if", "(", "is_string", "(", "$", "xml", ")", ")", "{", "$", "xml", "=", "simplex...
Convert XML to array. @param string $xml @return array
[ "Convert", "XML", "to", "array", "." ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L1207-L1226
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.reload
public function reload() { $id = $this->getRecordIdent(); $this->dataReset(); $this->loadFromFlexiBee($id); return $this->lastResponseCode == 200; }
php
public function reload() { $id = $this->getRecordIdent(); $this->dataReset(); $this->loadFromFlexiBee($id); return $this->lastResponseCode == 200; }
[ "public", "function", "reload", "(", ")", "{", "$", "id", "=", "$", "this", "->", "getRecordIdent", "(", ")", ";", "$", "this", "->", "dataReset", "(", ")", ";", "$", "this", "->", "loadFromFlexiBee", "(", "$", "id", ")", ";", "return", "$", "this"...
Reload current record from FlexiBee @return boolean
[ "Reload", "current", "record", "from", "FlexiBee" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L1400-L1406
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.setFilter
public function setFilter($filter) { return $this->filter = is_array($filter) ? self::flexiUrl($filter) : $filter; }
php
public function setFilter($filter) { return $this->filter = is_array($filter) ? self::flexiUrl($filter) : $filter; }
[ "public", "function", "setFilter", "(", "$", "filter", ")", "{", "return", "$", "this", "->", "filter", "=", "is_array", "(", "$", "filter", ")", "?", "self", "::", "flexiUrl", "(", "$", "filter", ")", ":", "$", "filter", ";", "}" ]
Set Filter code for requests @link https://www.flexibee.eu/api/dokumentace/ref/zamykani-odemykani/ @param array|string $filter filter formula or ['key'=>'value'] @return string Filter code
[ "Set", "Filter", "code", "for", "requests" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L1417-L1420
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.join
public function join(&$object) { $result = true; if (method_exists($object, 'getDataForJSON')) { $this->chained[] = $object; } else { throw new \Ease\Exception('$object->getDataForJSON() does not exist'); } return $result; }
php
public function join(&$object) { $result = true; if (method_exists($object, 'getDataForJSON')) { $this->chained[] = $object; } else { throw new \Ease\Exception('$object->getDataForJSON() does not exist'); } return $result; }
[ "public", "function", "join", "(", "&", "$", "object", ")", "{", "$", "result", "=", "true", ";", "if", "(", "method_exists", "(", "$", "object", ",", "'getDataForJSON'", ")", ")", "{", "$", "this", "->", "chained", "[", "]", "=", "$", "object", ";...
Join another FlexiPeeHP Object @param FlexiBeeRO $object @return boolean adding to stack success
[ "Join", "another", "FlexiPeeHP", "Object" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L1506-L1516
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.urlizeId
public static function urlizeId($id) { if (is_array($id)) { $id = rawurlencode('('.self::flexiUrl($id).')'); } else if (preg_match('/^ext:/', $id)) { $id = self::urlEncode($id); } else if (preg_match('/^code:/', $id)) { $id = self::code(self::urlEncode(self::uncode($id))); } return $id; }
php
public static function urlizeId($id) { if (is_array($id)) { $id = rawurlencode('('.self::flexiUrl($id).')'); } else if (preg_match('/^ext:/', $id)) { $id = self::urlEncode($id); } else if (preg_match('/^code:/', $id)) { $id = self::code(self::urlEncode(self::uncode($id))); } return $id; }
[ "public", "static", "function", "urlizeId", "(", "$", "id", ")", "{", "if", "(", "is_array", "(", "$", "id", ")", ")", "{", "$", "id", "=", "rawurlencode", "(", "'('", ".", "self", "::", "flexiUrl", "(", "$", "id", ")", ".", "')'", ")", ";", "}...
Prepare record ID to use in URL @param mixed $id @return string id ready for use in URL
[ "Prepare", "record", "ID", "to", "use", "in", "URL" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L1525-L1535
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.idExists
public function idExists($identifer = null) { if (is_null($identifer)) { $identifer = $this->getMyKey(); } $ignorestate = $this->ignore404(); $this->ignore404(true); $cands = $this->getFlexiData(null, [ 'detail' => 'custom:'.$this->getKeyColumn(), $this->getKeyColumn() => $identifer ]); $this->ignore404($ignorestate); return ($this->lastResponseCode == 200) && !empty($cands); }
php
public function idExists($identifer = null) { if (is_null($identifer)) { $identifer = $this->getMyKey(); } $ignorestate = $this->ignore404(); $this->ignore404(true); $cands = $this->getFlexiData(null, [ 'detail' => 'custom:'.$this->getKeyColumn(), $this->getKeyColumn() => $identifer ]); $this->ignore404($ignorestate); return ($this->lastResponseCode == 200) && !empty($cands); }
[ "public", "function", "idExists", "(", "$", "identifer", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "identifer", ")", ")", "{", "$", "identifer", "=", "$", "this", "->", "getMyKey", "(", ")", ";", "}", "$", "ignorestate", "=", "$", "thi...
Test if given record ID exists in FlexiBee. @param mixed $identifer presence state @return boolean
[ "Test", "if", "given", "record", "ID", "exists", "in", "FlexiBee", "." ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L1544-L1558
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.recordExists
public function recordExists($data = []) { if (empty($data)) { $data = $this->getData(); } $ignorestate = $this->ignore404(); $this->ignore404(true); $keyColumn = $this->getKeyColumn(); $res = $this->getColumnsFromFlexibee([$keyColumn], is_array($data) ? $data : [$keyColumn => $data]); if (empty($res) || (isset($res['success']) && ($res['success'] == 'false')) || ((isset($res) && is_array($res)) && !isset($res[0]) )) { $found = false; } else { $found = true; } $this->ignore404($ignorestate); return $found; }
php
public function recordExists($data = []) { if (empty($data)) { $data = $this->getData(); } $ignorestate = $this->ignore404(); $this->ignore404(true); $keyColumn = $this->getKeyColumn(); $res = $this->getColumnsFromFlexibee([$keyColumn], is_array($data) ? $data : [$keyColumn => $data]); if (empty($res) || (isset($res['success']) && ($res['success'] == 'false')) || ((isset($res) && is_array($res)) && !isset($res[0]) )) { $found = false; } else { $found = true; } $this->ignore404($ignorestate); return $found; }
[ "public", "function", "recordExists", "(", "$", "data", "=", "[", "]", ")", "{", "if", "(", "empty", "(", "$", "data", ")", ")", "{", "$", "data", "=", "$", "this", "->", "getData", "(", ")", ";", "}", "$", "ignorestate", "=", "$", "this", "->"...
Test if given record exists in FlexiBee. @param array|string|int $data ext:id:23|code:ITEM|['id'=>23]|23 @return boolean Record presence status
[ "Test", "if", "given", "record", "exists", "in", "FlexiBee", "." ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L1567-L1587
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.getSubItems
public function getSubItems() { return array_key_exists('polozkyFaktury', $this->getData()) ? $this->getDataValue('polozkyFaktury') : (array_key_exists('polozkyDokladu', $this->getData()) ? $this->getDataValue('polozkyDokladu') : null); }
php
public function getSubItems() { return array_key_exists('polozkyFaktury', $this->getData()) ? $this->getDataValue('polozkyFaktury') : (array_key_exists('polozkyDokladu', $this->getData()) ? $this->getDataValue('polozkyDokladu') : null); }
[ "public", "function", "getSubItems", "(", ")", "{", "return", "array_key_exists", "(", "'polozkyFaktury'", ",", "$", "this", "->", "getData", "(", ")", ")", "?", "$", "this", "->", "getDataValue", "(", "'polozkyFaktury'", ")", ":", "(", "array_key_exists", "...
Subitems - ex. items of invoice @return array of document items or null
[ "Subitems", "-", "ex", ".", "items", "of", "invoice" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L1594-L1599
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.logResult
public function logResult($resultData = null, $url = null) { $logResult = false; if (isset($resultData['success']) && ($resultData['success'] == 'false')) { if (isset($resultData['message'])) { $this->addStatusMessage($resultData['message'], 'warning'); } $this->addStatusMessage('Error '.$this->lastResponseCode.': '.urldecode($url), 'warning'); unset($url); } if (is_null($resultData)) { $resultData = $this->lastResult; } if (isset($url)) { $this->logger->addStatusMessage($this->lastResponseCode.':'.urldecode($url)); } if (isset($resultData['results'])) { if ($resultData['success'] == 'false') { $status = 'error'; } else { $status = 'success'; } foreach ($resultData['results'] as $result) { if (isset($result['request-id'])) { $rid = $result['request-id']; } else { $rid = ''; } if (isset($result['errors'])) { foreach ($result['errors'] as $error) { $message = $error['message']; if (isset($error['for'])) { $message .= ' for: '.$error['for']; } if (isset($error['value'])) { $message .= ' value:'.$error['value']; } if (isset($error['code'])) { $message .= ' code:'.$error['code']; } $this->addStatusMessage($rid.': '.$message, $status); } } } } return $logResult; }
php
public function logResult($resultData = null, $url = null) { $logResult = false; if (isset($resultData['success']) && ($resultData['success'] == 'false')) { if (isset($resultData['message'])) { $this->addStatusMessage($resultData['message'], 'warning'); } $this->addStatusMessage('Error '.$this->lastResponseCode.': '.urldecode($url), 'warning'); unset($url); } if (is_null($resultData)) { $resultData = $this->lastResult; } if (isset($url)) { $this->logger->addStatusMessage($this->lastResponseCode.':'.urldecode($url)); } if (isset($resultData['results'])) { if ($resultData['success'] == 'false') { $status = 'error'; } else { $status = 'success'; } foreach ($resultData['results'] as $result) { if (isset($result['request-id'])) { $rid = $result['request-id']; } else { $rid = ''; } if (isset($result['errors'])) { foreach ($result['errors'] as $error) { $message = $error['message']; if (isset($error['for'])) { $message .= ' for: '.$error['for']; } if (isset($error['value'])) { $message .= ' value:'.$error['value']; } if (isset($error['code'])) { $message .= ' code:'.$error['code']; } $this->addStatusMessage($rid.': '.$message, $status); } } } } return $logResult; }
[ "public", "function", "logResult", "(", "$", "resultData", "=", "null", ",", "$", "url", "=", "null", ")", "{", "$", "logResult", "=", "false", ";", "if", "(", "isset", "(", "$", "resultData", "[", "'success'", "]", ")", "&&", "(", "$", "resultData",...
Write Operation Result. @param array $resultData @param string $url URL @return boolean Log save success
[ "Write", "Operation", "Result", "." ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L1744-L1792
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.saveDebugFiles
public function saveDebugFiles() { $tmpdir = sys_get_temp_dir(); $fname = $this->evidence.'-'.$this->curlInfo['when'].'.'.$this->format; $reqname = $tmpdir.'/request-'.$fname; $respname = $tmpdir.'/response-'.$fname; if (file_put_contents($reqname, $this->postFields)) { $this->addStatusMessage($reqname, 'debug'); } if (file_put_contents($respname, $this->lastCurlResponse)) { $this->addStatusMessage($respname, 'debug'); } }
php
public function saveDebugFiles() { $tmpdir = sys_get_temp_dir(); $fname = $this->evidence.'-'.$this->curlInfo['when'].'.'.$this->format; $reqname = $tmpdir.'/request-'.$fname; $respname = $tmpdir.'/response-'.$fname; if (file_put_contents($reqname, $this->postFields)) { $this->addStatusMessage($reqname, 'debug'); } if (file_put_contents($respname, $this->lastCurlResponse)) { $this->addStatusMessage($respname, 'debug'); } }
[ "public", "function", "saveDebugFiles", "(", ")", "{", "$", "tmpdir", "=", "sys_get_temp_dir", "(", ")", ";", "$", "fname", "=", "$", "this", "->", "evidence", ".", "'-'", ".", "$", "this", "->", "curlInfo", "[", "'when'", "]", ".", "'.'", ".", "$", ...
Save RAW Curl Request & Response to files in Temp directory
[ "Save", "RAW", "Curl", "Request", "&", "Response", "to", "files", "in", "Temp", "directory" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L1797-L1809
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.getFirstRecordID
public function getFirstRecordID() { $firstID = null; $keyColumn = $this->getKeyColumn(); $firstIdRaw = $this->getColumnsFromFlexibee([$keyColumn], ['limit' => 1, 'order' => $keyColumn], $keyColumn); if (!empty($firstIdRaw) && isset(current($firstIdRaw)[$keyColumn])) { $firstID = current($firstIdRaw)[$keyColumn]; } return is_numeric($firstID) ? intval($firstID) : $firstID; }
php
public function getFirstRecordID() { $firstID = null; $keyColumn = $this->getKeyColumn(); $firstIdRaw = $this->getColumnsFromFlexibee([$keyColumn], ['limit' => 1, 'order' => $keyColumn], $keyColumn); if (!empty($firstIdRaw) && isset(current($firstIdRaw)[$keyColumn])) { $firstID = current($firstIdRaw)[$keyColumn]; } return is_numeric($firstID) ? intval($firstID) : $firstID; }
[ "public", "function", "getFirstRecordID", "(", ")", "{", "$", "firstID", "=", "null", ";", "$", "keyColumn", "=", "$", "this", "->", "getKeyColumn", "(", ")", ";", "$", "firstIdRaw", "=", "$", "this", "->", "getColumnsFromFlexibee", "(", "[", "$", "keyCo...
Obtain ID of first record in evidence @return string|null id or null if no records
[ "Obtain", "ID", "of", "first", "record", "in", "evidence" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L2002-L2012
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.getNextRecordID
function getNextRecordID($conditions = []) { $conditions['order'] = 'id@D'; $conditions['limit'] = 1; $conditions[] = 'id gt '.$this->getRecordID(); $next = $this->getColumnsFromFlexibee(['id'], $conditions); return (is_array($next) && array_key_exists(0, $next) && array_key_exists('id', $next[0])) ? intval($next[0]['id']) : null; }
php
function getNextRecordID($conditions = []) { $conditions['order'] = 'id@D'; $conditions['limit'] = 1; $conditions[] = 'id gt '.$this->getRecordID(); $next = $this->getColumnsFromFlexibee(['id'], $conditions); return (is_array($next) && array_key_exists(0, $next) && array_key_exists('id', $next[0])) ? intval($next[0]['id']) : null; }
[ "function", "getNextRecordID", "(", "$", "conditions", "=", "[", "]", ")", "{", "$", "conditions", "[", "'order'", "]", "=", "'id@D'", ";", "$", "conditions", "[", "'limit'", "]", "=", "1", ";", "$", "conditions", "[", "]", "=", "'id gt '", ".", "$",...
Get previous record ID @param array $conditions optional @return int|null
[ "Get", "previous", "record", "ID" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L2021-L2029
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.getPrevRecordID
function getPrevRecordID($conditions = []) { $conditions['order'] = 'id@A'; $conditions['limit'] = 1; $conditions[] = 'id lt '.$this->getRecordID(); $prev = $this->getColumnsFromFlexibee(['id'], $conditions); return (is_array($prev) && array_key_exists(0, $prev) && array_key_exists('id', $prev[0])) ? intval($prev[0]['id']) : null; }
php
function getPrevRecordID($conditions = []) { $conditions['order'] = 'id@A'; $conditions['limit'] = 1; $conditions[] = 'id lt '.$this->getRecordID(); $prev = $this->getColumnsFromFlexibee(['id'], $conditions); return (is_array($prev) && array_key_exists(0, $prev) && array_key_exists('id', $prev[0])) ? intval($prev[0]['id']) : null; }
[ "function", "getPrevRecordID", "(", "$", "conditions", "=", "[", "]", ")", "{", "$", "conditions", "[", "'order'", "]", "=", "'id@A'", ";", "$", "conditions", "[", "'limit'", "]", "=", "1", ";", "$", "conditions", "[", "]", "=", "'id lt '", ".", "$",...
Get next record ID @param array $conditions optional @return int|null
[ "Get", "next", "record", "ID" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L2038-L2046
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.getApiURL
public function getApiURL($format = null) { $apiUrl = str_replace(['.'.$this->format, '?limit=0'], '', $this->apiURL); return $apiUrl.(empty($format) ? '' : '.'.$format ); }
php
public function getApiURL($format = null) { $apiUrl = str_replace(['.'.$this->format, '?limit=0'], '', $this->apiURL); return $apiUrl.(empty($format) ? '' : '.'.$format ); }
[ "public", "function", "getApiURL", "(", "$", "format", "=", "null", ")", "{", "$", "apiUrl", "=", "str_replace", "(", "[", "'.'", ".", "$", "this", "->", "format", ",", "'?limit=0'", "]", ",", "''", ",", "$", "this", "->", "apiURL", ")", ";", "retu...
Gives you current ApiURL with given format suffix @param string $format json|html|xml|... @return string API URL for current record or object/evidence
[ "Gives", "you", "current", "ApiURL", "with", "given", "format", "suffix" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L2116-L2120
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.unifyResponseFormat
public function unifyResponseFormat($responseBody) { if (!is_array($responseBody) || array_key_exists('message', $responseBody)) { //Unifi response format $response = $responseBody; } else { $evidence = $this->getResponseEvidence(); if (array_key_exists($evidence, $responseBody)) { $response = []; $evidenceContent = $responseBody[$evidence]; if (array_key_exists(0, $evidenceContent)) { $response[$evidence] = $evidenceContent; //Multiplete Results } else { $response[$evidence][0] = $evidenceContent; //One result } } else { if (isset($responseBody['priloha'])) { $response = $responseBody['priloha']; } else { if (array_key_exists('results', $responseBody)) { $response = $responseBody['results']; } else { $response = $responseBody; } } } } return $response; }
php
public function unifyResponseFormat($responseBody) { if (!is_array($responseBody) || array_key_exists('message', $responseBody)) { //Unifi response format $response = $responseBody; } else { $evidence = $this->getResponseEvidence(); if (array_key_exists($evidence, $responseBody)) { $response = []; $evidenceContent = $responseBody[$evidence]; if (array_key_exists(0, $evidenceContent)) { $response[$evidence] = $evidenceContent; //Multiplete Results } else { $response[$evidence][0] = $evidenceContent; //One result } } else { if (isset($responseBody['priloha'])) { $response = $responseBody['priloha']; } else { if (array_key_exists('results', $responseBody)) { $response = $responseBody['results']; } else { $response = $responseBody; } } } } return $response; }
[ "public", "function", "unifyResponseFormat", "(", "$", "responseBody", ")", "{", "if", "(", "!", "is_array", "(", "$", "responseBody", ")", "||", "array_key_exists", "(", "'message'", ",", "$", "responseBody", ")", ")", "{", "//Unifi response format", "$", "re...
Return the same response format for one and multiplete results @param array $responseBody @return array
[ "Return", "the", "same", "response", "format", "for", "one", "and", "multiplete", "results" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L2139-L2167
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.getOnlineColumnsInfo
public function getOnlineColumnsInfo($evidence = null) { $properties = []; $evidence = is_null($evidence) ? $this->getEvidence() : $evidence; $flexinfo = $this->performRequest('/c/'.$this->company.'/'.$evidence.'/properties.json'); if (count($flexinfo) && array_key_exists('properties', $flexinfo)) { foreach ($flexinfo['properties']['property'] as $evidenceProperty) { $key = $evidenceProperty['propertyName']; $properties[$key] = $evidenceProperty; $properties[$key]['name'] = $evidenceProperty['name']; $properties[$key]['type'] = $evidenceProperty['type']; if (array_key_exists('url', $evidenceProperty)) { $properties[$key]['url'] = str_replace('?limit=0', '', $evidenceProperty['url']); } } } return $properties; }
php
public function getOnlineColumnsInfo($evidence = null) { $properties = []; $evidence = is_null($evidence) ? $this->getEvidence() : $evidence; $flexinfo = $this->performRequest('/c/'.$this->company.'/'.$evidence.'/properties.json'); if (count($flexinfo) && array_key_exists('properties', $flexinfo)) { foreach ($flexinfo['properties']['property'] as $evidenceProperty) { $key = $evidenceProperty['propertyName']; $properties[$key] = $evidenceProperty; $properties[$key]['name'] = $evidenceProperty['name']; $properties[$key]['type'] = $evidenceProperty['type']; if (array_key_exists('url', $evidenceProperty)) { $properties[$key]['url'] = str_replace('?limit=0', '', $evidenceProperty['url']); } } } return $properties; }
[ "public", "function", "getOnlineColumnsInfo", "(", "$", "evidence", "=", "null", ")", "{", "$", "properties", "=", "[", "]", ";", "$", "evidence", "=", "is_null", "(", "$", "evidence", ")", "?", "$", "this", "->", "getEvidence", "(", ")", ":", "$", "...
Obtain Current evidence Live structure @param string $evidence @return array structure
[ "Obtain", "Current", "evidence", "Live", "structure" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L2194-L2212
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.updateColumnsInfo
public function updateColumnsInfo($columnsInfo = null, $evidence = null) { $evidence = is_null($evidence) ? $this->getEvidence() : $evidence; if (is_null($columnsInfo)) { $this->columnsInfo[$evidence] = $this->offline ? $this->getOfflineColumnsInfo($evidence) : $this->getOnlineColumnsInfo($evidence); } else { $this->columnsInfo[$evidence] = $columnsInfo; } }
php
public function updateColumnsInfo($columnsInfo = null, $evidence = null) { $evidence = is_null($evidence) ? $this->getEvidence() : $evidence; if (is_null($columnsInfo)) { $this->columnsInfo[$evidence] = $this->offline ? $this->getOfflineColumnsInfo($evidence) : $this->getOnlineColumnsInfo($evidence); } else { $this->columnsInfo[$evidence] = $columnsInfo; } }
[ "public", "function", "updateColumnsInfo", "(", "$", "columnsInfo", "=", "null", ",", "$", "evidence", "=", "null", ")", "{", "$", "evidence", "=", "is_null", "(", "$", "evidence", ")", "?", "$", "this", "->", "getEvidence", "(", ")", ":", "$", "eviden...
Update evidence info from array or online from properties.json or offline @param array $columnsInfo @param string $evidence
[ "Update", "evidence", "info", "from", "array", "or", "online", "from", "properties", ".", "json", "or", "offline" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L2220-L2229
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.saveResponseToFile
public function saveResponseToFile($destfile) { if (strlen($this->lastCurlResponse)) { $this->doCurlRequest($this->apiURL, 'GET', $this->format); } file_put_contents($destfile, $this->lastCurlResponse); }
php
public function saveResponseToFile($destfile) { if (strlen($this->lastCurlResponse)) { $this->doCurlRequest($this->apiURL, 'GET', $this->format); } file_put_contents($destfile, $this->lastCurlResponse); }
[ "public", "function", "saveResponseToFile", "(", "$", "destfile", ")", "{", "if", "(", "strlen", "(", "$", "this", "->", "lastCurlResponse", ")", ")", "{", "$", "this", "->", "doCurlRequest", "(", "$", "this", "->", "apiURL", ",", "'GET'", ",", "$", "t...
Save current object to file @param string $destfile path to file
[ "Save", "current", "object", "to", "file" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L2353-L2359
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.getVazby
public function getVazby($id = null) { if (is_null($id)) { $id = $this->getRecordID(); } if (!empty($id)) { $vazbyRaw = $this->getColumnsFromFlexibee(['vazby'], ['relations' => 'vazby', 'id' => $id]); $vazby = array_key_exists('vazby', $vazbyRaw[0]) ? $vazbyRaw[0]['vazby'] : null; } else { throw new \Exception(_('ID requied to get record relations ')); } return $vazby; }
php
public function getVazby($id = null) { if (is_null($id)) { $id = $this->getRecordID(); } if (!empty($id)) { $vazbyRaw = $this->getColumnsFromFlexibee(['vazby'], ['relations' => 'vazby', 'id' => $id]); $vazby = array_key_exists('vazby', $vazbyRaw[0]) ? $vazbyRaw[0]['vazby'] : null; } else { throw new \Exception(_('ID requied to get record relations ')); } return $vazby; }
[ "public", "function", "getVazby", "(", "$", "id", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "id", ")", ")", "{", "$", "id", "=", "$", "this", "->", "getRecordID", "(", ")", ";", "}", "if", "(", "!", "empty", "(", "$", "id", ")", ...
Obtain established relations listing @return array Null or Relations
[ "Obtain", "established", "relations", "listing" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L2366-L2380
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.getFlexiBeeURL
public function getFlexiBeeURL() { $parsed_url = parse_url(str_replace('.'.$this->format, '', $this->apiURL)); $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'].'://' : ''; $host = isset($parsed_url['host']) ? $parsed_url['host'] : ''; $port = isset($parsed_url['port']) ? ':'.$parsed_url['port'] : ''; $user = isset($parsed_url['user']) ? $parsed_url['user'] : ''; $pass = isset($parsed_url['pass']) ? ':'.$parsed_url['pass'] : ''; $pass = ($user || $pass) ? "$pass@" : ''; $path = isset($parsed_url['path']) ? $parsed_url['path'] : ''; return $scheme.$user.$pass.$host.$port.$path; }
php
public function getFlexiBeeURL() { $parsed_url = parse_url(str_replace('.'.$this->format, '', $this->apiURL)); $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'].'://' : ''; $host = isset($parsed_url['host']) ? $parsed_url['host'] : ''; $port = isset($parsed_url['port']) ? ':'.$parsed_url['port'] : ''; $user = isset($parsed_url['user']) ? $parsed_url['user'] : ''; $pass = isset($parsed_url['pass']) ? ':'.$parsed_url['pass'] : ''; $pass = ($user || $pass) ? "$pass@" : ''; $path = isset($parsed_url['path']) ? $parsed_url['path'] : ''; return $scheme.$user.$pass.$host.$port.$path; }
[ "public", "function", "getFlexiBeeURL", "(", ")", "{", "$", "parsed_url", "=", "parse_url", "(", "str_replace", "(", "'.'", ".", "$", "this", "->", "format", ",", "''", ",", "$", "this", "->", "apiURL", ")", ")", ";", "$", "scheme", "=", "isset", "("...
Gives You URL for Current Record in FlexiBee web interface @return string url
[ "Gives", "You", "URL", "for", "Current", "Record", "in", "FlexiBee", "web", "interface" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L2387-L2399
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.setMyKey
public function setMyKey($myKeyValue) { if (substr($myKeyValue, 0, 4) == 'ext:') { if ($this->evidenceInfo['extIdSupported'] == 'false') { $this->addStatusMessage(sprintf(_('Evidence %s does not support extIDs'), $this->getEvidence()), 'warning'); $res = false; } else { $extIds = $this->getDataValue('external-ids'); if (!empty($extIds) && count($extIds)) { $extIds = array_combine($extIds, $extIds); } $extIds[$myKeyValue] = $myKeyValue; $res = $this->setDataValue('external-ids', $extIds); } } else { $res = parent::setMyKey($myKeyValue); } $this->updateApiURL(); return $res; }
php
public function setMyKey($myKeyValue) { if (substr($myKeyValue, 0, 4) == 'ext:') { if ($this->evidenceInfo['extIdSupported'] == 'false') { $this->addStatusMessage(sprintf(_('Evidence %s does not support extIDs'), $this->getEvidence()), 'warning'); $res = false; } else { $extIds = $this->getDataValue('external-ids'); if (!empty($extIds) && count($extIds)) { $extIds = array_combine($extIds, $extIds); } $extIds[$myKeyValue] = $myKeyValue; $res = $this->setDataValue('external-ids', $extIds); } } else { $res = parent::setMyKey($myKeyValue); } $this->updateApiURL(); return $res; }
[ "public", "function", "setMyKey", "(", "$", "myKeyValue", ")", "{", "if", "(", "substr", "(", "$", "myKeyValue", ",", "0", ",", "4", ")", "==", "'ext:'", ")", "{", "if", "(", "$", "this", "->", "evidenceInfo", "[", "'extIdSupported'", "]", "==", "'fa...
Set Record Key @param int|string $myKeyValue @return boolean
[ "Set", "Record", "Key" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L2408-L2430
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.ignore404
public function ignore404($ignore = null) { if (!is_null($ignore)) { $this->ignoreNotFound = $ignore; } return $this->ignoreNotFound; }
php
public function ignore404($ignore = null) { if (!is_null($ignore)) { $this->ignoreNotFound = $ignore; } return $this->ignoreNotFound; }
[ "public", "function", "ignore404", "(", "$", "ignore", "=", "null", ")", "{", "if", "(", "!", "is_null", "(", "$", "ignore", ")", ")", "{", "$", "this", "->", "ignoreNotFound", "=", "$", "ignore", ";", "}", "return", "$", "this", "->", "ignoreNotFoun...
Set or get ignore not found pages flag @param boolean $ignore set flag to @return boolean get flag state
[ "Set", "or", "get", "ignore", "not", "found", "pages", "flag" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L2439-L2445
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.sendByMail
public function sendByMail($to, $subject, $body, $cc = null) { $this->setPostFields($body); $this->performRequest(rawurlencode($this->getRecordID()).'/odeslani-dokladu?to='.$to.'&subject='.urlencode($subject).'&cc='.$cc , 'PUT', 'xml'); return $this->lastResponseCode == 200; }
php
public function sendByMail($to, $subject, $body, $cc = null) { $this->setPostFields($body); $this->performRequest(rawurlencode($this->getRecordID()).'/odeslani-dokladu?to='.$to.'&subject='.urlencode($subject).'&cc='.$cc , 'PUT', 'xml'); return $this->lastResponseCode == 200; }
[ "public", "function", "sendByMail", "(", "$", "to", ",", "$", "subject", ",", "$", "body", ",", "$", "cc", "=", "null", ")", "{", "$", "this", "->", "setPostFields", "(", "$", "body", ")", ";", "$", "this", "->", "performRequest", "(", "rawurlencode"...
Send Document by mail @url https://www.flexibee.eu/api/dokumentace/ref/odesilani-mailem/ @param string $to Email ecipient @param string $subject Email Subject @param string $body Email Text @return boolean mail sent status
[ "Send", "Document", "by", "mail" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L2458-L2466
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.flexiDateToDateTime
public static function flexiDateToDateTime($flexidate) { return \DateTime::createFromFormat(strstr($flexidate, '+') ? self::$DateFormat.'O' : self::$DateFormat, $flexidate)->setTime(0, 0); }
php
public static function flexiDateToDateTime($flexidate) { return \DateTime::createFromFormat(strstr($flexidate, '+') ? self::$DateFormat.'O' : self::$DateFormat, $flexidate)->setTime(0, 0); }
[ "public", "static", "function", "flexiDateToDateTime", "(", "$", "flexidate", ")", "{", "return", "\\", "DateTime", "::", "createFromFormat", "(", "strstr", "(", "$", "flexidate", ",", "'+'", ")", "?", "self", "::", "$", "DateFormat", ".", "'O'", ":", "sel...
FlexiBee date to PHP DateTime conversion @param string $flexidate 2017-05-26 or 2017-05-26+02:00 @return \DateTime | false
[ "FlexiBee", "date", "to", "PHP", "DateTime", "conversion" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L2488-L2492
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.flexiDateTimeToDateTime
public static function flexiDateTimeToDateTime($flexidatetime) { if (strchr($flexidatetime, '.')) { //NewFormat $format = self::$DateTimeFormat; } else { // Old format $format = 'Y-m-d\TH:i:s+P'; } return \DateTime::createFromFormat($format, $flexidatetime); }
php
public static function flexiDateTimeToDateTime($flexidatetime) { if (strchr($flexidatetime, '.')) { //NewFormat $format = self::$DateTimeFormat; } else { // Old format $format = 'Y-m-d\TH:i:s+P'; } return \DateTime::createFromFormat($format, $flexidatetime); }
[ "public", "static", "function", "flexiDateTimeToDateTime", "(", "$", "flexidatetime", ")", "{", "if", "(", "strchr", "(", "$", "flexidatetime", ",", "'.'", ")", ")", "{", "//NewFormat", "$", "format", "=", "self", "::", "$", "DateTimeFormat", ";", "}", "el...
FlexiBee dateTime to PHP DateTime conversion @param string $flexidatetime 2017-09-26T10:00:53.755+02:00 or older 2017-05-19T00:00:00+02:00 @return \DateTime | false
[ "FlexiBee", "dateTime", "to", "PHP", "DateTime", "conversion" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L2501-L2509
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.takeData
public function takeData($data) { $keyColumn = $this->getKeyColumn(); if (array_key_exists($keyColumn, $data) && is_array($data[$keyColumn])) { foreach ($data[$keyColumn] as $recPos => $recordKey) { if (substr($recordKey, 0, 4) == 'ext:') { $data['external-ids'][] = $recordKey; unset($data[$keyColumn][$recPos]); } } if (count($data[$keyColumn]) == 1) { $data[$keyColumn] = current($data[$keyColumn]); } } $result = parent::takeData($data); if (array_key_exists($keyColumn, $data) || array_key_exists('kod', $data)) { $this->updateApiURL(); } return $result; }
php
public function takeData($data) { $keyColumn = $this->getKeyColumn(); if (array_key_exists($keyColumn, $data) && is_array($data[$keyColumn])) { foreach ($data[$keyColumn] as $recPos => $recordKey) { if (substr($recordKey, 0, 4) == 'ext:') { $data['external-ids'][] = $recordKey; unset($data[$keyColumn][$recPos]); } } if (count($data[$keyColumn]) == 1) { $data[$keyColumn] = current($data[$keyColumn]); } } $result = parent::takeData($data); if (array_key_exists($keyColumn, $data) || array_key_exists('kod', $data)) { $this->updateApiURL(); } return $result; }
[ "public", "function", "takeData", "(", "$", "data", ")", "{", "$", "keyColumn", "=", "$", "this", "->", "getKeyColumn", "(", ")", ";", "if", "(", "array_key_exists", "(", "$", "keyColumn", ",", "$", "data", ")", "&&", "is_array", "(", "$", "data", "[...
Take data for object. separate external IDs @param array $data Data to keep @return int number of records taken
[ "Take", "data", "for", "object", ".", "separate", "external", "IDs" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L2599-L2620
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.getReportsInfo
public function getReportsInfo() { $reports = []; $reportsRaw = $this->getFlexiData($this->getEvidenceURL().'/reports'); if (!empty($reportsRaw) && array_key_exists('reports', $reportsRaw) && !empty($reportsRaw['reports']) && array_key_exists('report', $reportsRaw['reports']) && !empty($reportsRaw['reports']['report'])) { if (\Ease\jQuery\Part::isAssoc($reportsRaw['reports']['report'])) { $reports = [$reportsRaw['reports']['report']['reportId'] => $reportsRaw['reports']['report']]; } else { $reports = self::reindexArrayBy($reportsRaw['reports']['report'], 'reportId'); } } return $reports; }
php
public function getReportsInfo() { $reports = []; $reportsRaw = $this->getFlexiData($this->getEvidenceURL().'/reports'); if (!empty($reportsRaw) && array_key_exists('reports', $reportsRaw) && !empty($reportsRaw['reports']) && array_key_exists('report', $reportsRaw['reports']) && !empty($reportsRaw['reports']['report'])) { if (\Ease\jQuery\Part::isAssoc($reportsRaw['reports']['report'])) { $reports = [$reportsRaw['reports']['report']['reportId'] => $reportsRaw['reports']['report']]; } else { $reports = self::reindexArrayBy($reportsRaw['reports']['report'], 'reportId'); } } return $reports; }
[ "public", "function", "getReportsInfo", "(", ")", "{", "$", "reports", "=", "[", "]", ";", "$", "reportsRaw", "=", "$", "this", "->", "getFlexiData", "(", "$", "this", "->", "getEvidenceURL", "(", ")", ".", "'/reports'", ")", ";", "if", "(", "!", "em...
Get Current Evidence reports listing @link https://www.flexibee.eu/api/dokumentace/casto-kladene-dotazy-pro-api/vyber-reportu-do-pdf/ Výběr reportu do PDF @return array
[ "Get", "Current", "Evidence", "reports", "listing" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L2629-L2644
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.requestAuthSessionID
public function requestAuthSessionID($username, $password, $otp = null) { $this->postFields = http_build_query(is_null($otp) ? ['username' => $username, 'password' => $password] : ['username' => $username, 'password' => $password, 'otp' => $otp]); $response = $this->performRequest('/login-logout/login', 'POST', 'json'); if (array_key_exists('refreshToken', $response)) { $this->refreshToken = $response['refreshToken']; } else { $this->refreshToken = null; } return array_key_exists('authSessionId', $response) ? $response['authSessionId'] : null; }
php
public function requestAuthSessionID($username, $password, $otp = null) { $this->postFields = http_build_query(is_null($otp) ? ['username' => $username, 'password' => $password] : ['username' => $username, 'password' => $password, 'otp' => $otp]); $response = $this->performRequest('/login-logout/login', 'POST', 'json'); if (array_key_exists('refreshToken', $response)) { $this->refreshToken = $response['refreshToken']; } else { $this->refreshToken = null; } return array_key_exists('authSessionId', $response) ? $response['authSessionId'] : null; }
[ "public", "function", "requestAuthSessionID", "(", "$", "username", ",", "$", "password", ",", "$", "otp", "=", "null", ")", "{", "$", "this", "->", "postFields", "=", "http_build_query", "(", "is_null", "(", "$", "otp", ")", "?", "[", "'username'", "=>"...
Request authSessionId from current server @link https://www.flexibee.eu/api/dokumentace/ref/login/ description @param string $username @param string $password @param string $otp optional onetime password @return string authUserId or null in case of problems
[ "Request", "authSessionId", "from", "current", "server" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L2657-L2671
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.login
public function login() { $this->authSessionId = $this->requestAuthSessionID($this->user, $this->password); return $this->lastResponseCode == 200; }
php
public function login() { $this->authSessionId = $this->requestAuthSessionID($this->user, $this->password); return $this->lastResponseCode == 200; }
[ "public", "function", "login", "(", ")", "{", "$", "this", "->", "authSessionId", "=", "$", "this", "->", "requestAuthSessionID", "(", "$", "this", "->", "user", ",", "$", "this", "->", "password", ")", ";", "return", "$", "this", "->", "lastResponseCode...
Try to Sign in current user to FlexiBee and keep authSessionId @return boolean sign in success
[ "Try", "to", "Sign", "in", "current", "user", "to", "FlexiBee", "and", "keep", "authSessionId" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L2678-L2683
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FlexiBeeRO.php
FlexiBeeRO.logBanner
public function logBanner($additions = null) { $this->addStatusMessage('FlexiBee '.str_replace('://', '://'.$this->user.'@', $this->getApiUrl()).' FlexiPeeHP v'.self::$libVersion.' (FlexiBee '.EvidenceList::$version.') EasePHP Framework v'.\Ease\Atom::$frameworkVersion.' '.$additions, 'debug'); }
php
public function logBanner($additions = null) { $this->addStatusMessage('FlexiBee '.str_replace('://', '://'.$this->user.'@', $this->getApiUrl()).' FlexiPeeHP v'.self::$libVersion.' (FlexiBee '.EvidenceList::$version.') EasePHP Framework v'.\Ease\Atom::$frameworkVersion.' '.$additions, 'debug'); }
[ "public", "function", "logBanner", "(", "$", "additions", "=", "null", ")", "{", "$", "this", "->", "addStatusMessage", "(", "'FlexiBee '", ".", "str_replace", "(", "'://'", ",", "'://'", ".", "$", "this", "->", "user", ".", "'@'", ",", "$", "this", "-...
Add Info about used user, server and libraries @param string $additions Additional note text
[ "Add", "Info", "about", "used", "user", "server", "and", "libraries" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FlexiBeeRO.php#L2819-L2824
train
hiqdev/hipanel-core
src/base/Model.php
Model.defaultAttributeLabels
public function defaultAttributeLabels() { return [ 'id' => Yii::t('hipanel', 'ID'), 'remoteid' => Yii::t('hipanel', 'Remote ID'), 'client' => Yii::t('hipanel', 'Client'), 'client_id' => Yii::t('hipanel', 'Client'), 'seller' => Yii::t('hipanel', 'Reseller'), 'seller_id' => Yii::t('hipanel', 'Reseller'), 'domain' => Yii::t('hipanel', 'Domain name'), 'hdomain' => Yii::t('hipanel', 'Domain name'), 'ns' => Yii::t('hipanel', 'Name Server'), 'nss' => Yii::t('hipanel', 'Name Servers'), 'server' => Yii::t('hipanel', 'Server'), 'account' => Yii::t('hipanel', 'Account'), 'service' => Yii::t('hipanel', 'Service'), 'tariff' => Yii::t('hipanel', 'Tariff'), 'contact' => Yii::t('hipanel', 'Contact'), 'article' => Yii::t('hipanel', 'Article'), 'host' => Yii::t('hipanel', 'Host'), 'bill' => Yii::t('hipanel', 'Bill'), 'backup' => Yii::t('hipanel', 'Backup'), 'backuping' => Yii::t('hipanel', 'Backuping'), 'crontab' => Yii::t('hipanel', 'Crontab'), 'ip' => Yii::t('hipanel', 'IP'), 'ips' => Yii::t('hipanel', 'IPs'), 'mail' => Yii::t('hipanel', 'Mail'), 'request' => Yii::t('hipanel', 'Request'), 'db' => Yii::t('hipanel', 'Database'), 'state' => Yii::t('hipanel', 'Status'), 'status' => Yii::t('hipanel', 'Status'), 'states' => Yii::t('hipanel', 'Statuses'), 'type' => Yii::t('hipanel', 'Type'), 'types' => Yii::t('hipanel', 'Types'), 'note' => Yii::t('hipanel', 'Note'), 'descr' => Yii::t('hipanel', 'Description'), 'comment' => Yii::t('hipanel', 'Comment'), 'created_date' => Yii::t('hipanel', 'Registered'), 'updated_date' => Yii::t('hipanel', 'Last update'), ]; }
php
public function defaultAttributeLabels() { return [ 'id' => Yii::t('hipanel', 'ID'), 'remoteid' => Yii::t('hipanel', 'Remote ID'), 'client' => Yii::t('hipanel', 'Client'), 'client_id' => Yii::t('hipanel', 'Client'), 'seller' => Yii::t('hipanel', 'Reseller'), 'seller_id' => Yii::t('hipanel', 'Reseller'), 'domain' => Yii::t('hipanel', 'Domain name'), 'hdomain' => Yii::t('hipanel', 'Domain name'), 'ns' => Yii::t('hipanel', 'Name Server'), 'nss' => Yii::t('hipanel', 'Name Servers'), 'server' => Yii::t('hipanel', 'Server'), 'account' => Yii::t('hipanel', 'Account'), 'service' => Yii::t('hipanel', 'Service'), 'tariff' => Yii::t('hipanel', 'Tariff'), 'contact' => Yii::t('hipanel', 'Contact'), 'article' => Yii::t('hipanel', 'Article'), 'host' => Yii::t('hipanel', 'Host'), 'bill' => Yii::t('hipanel', 'Bill'), 'backup' => Yii::t('hipanel', 'Backup'), 'backuping' => Yii::t('hipanel', 'Backuping'), 'crontab' => Yii::t('hipanel', 'Crontab'), 'ip' => Yii::t('hipanel', 'IP'), 'ips' => Yii::t('hipanel', 'IPs'), 'mail' => Yii::t('hipanel', 'Mail'), 'request' => Yii::t('hipanel', 'Request'), 'db' => Yii::t('hipanel', 'Database'), 'state' => Yii::t('hipanel', 'Status'), 'status' => Yii::t('hipanel', 'Status'), 'states' => Yii::t('hipanel', 'Statuses'), 'type' => Yii::t('hipanel', 'Type'), 'types' => Yii::t('hipanel', 'Types'), 'note' => Yii::t('hipanel', 'Note'), 'descr' => Yii::t('hipanel', 'Description'), 'comment' => Yii::t('hipanel', 'Comment'), 'created_date' => Yii::t('hipanel', 'Registered'), 'updated_date' => Yii::t('hipanel', 'Last update'), ]; }
[ "public", "function", "defaultAttributeLabels", "(", ")", "{", "return", "[", "'id'", "=>", "Yii", "::", "t", "(", "'hipanel'", ",", "'ID'", ")", ",", "'remoteid'", "=>", "Yii", "::", "t", "(", "'hipanel'", ",", "'Remote ID'", ")", ",", "'client'", "=>",...
return default labels for attribute.
[ "return", "default", "labels", "for", "attribute", "." ]
090eb4b95dd731b338cd661b569f6b9b999f95e4
https://github.com/hiqdev/hipanel-core/blob/090eb4b95dd731b338cd661b569f6b9b999f95e4/src/base/Model.php#L34-L74
train
hiqdev/hipanel-core
src/base/Model.php
Model.mergeAttributeLabels
public function mergeAttributeLabels($labels) { if (!isset(static::$mergedLabels[static::class])) { $default = $this->defaultAttributeLabels(); foreach ($this->attributes() as $k) { $label = $labels[$k] ?: $default[$k]; if (!$label) { if (preg_match('/(.+)_[a-z]+$/', $k, $m)) { if (isset($labels[$m[1]])) { $label = $labels[$m[1]]; } } } if (!$label) { $toTranslate = preg_replace(['/_id$/', '/_label$/', '/_ids$/', '/_like$/'], [' ID', '', ' IDs', ''], $k); $toTranslate = preg_replace('/_/', ' ', $toTranslate); $label = Yii::t(static::$i18nDictionary, ucfirst($toTranslate)); } $labels[$k] = $label; } static::$mergedLabels[static::class] = $labels; } return static::$mergedLabels[static::class]; }
php
public function mergeAttributeLabels($labels) { if (!isset(static::$mergedLabels[static::class])) { $default = $this->defaultAttributeLabels(); foreach ($this->attributes() as $k) { $label = $labels[$k] ?: $default[$k]; if (!$label) { if (preg_match('/(.+)_[a-z]+$/', $k, $m)) { if (isset($labels[$m[1]])) { $label = $labels[$m[1]]; } } } if (!$label) { $toTranslate = preg_replace(['/_id$/', '/_label$/', '/_ids$/', '/_like$/'], [' ID', '', ' IDs', ''], $k); $toTranslate = preg_replace('/_/', ' ', $toTranslate); $label = Yii::t(static::$i18nDictionary, ucfirst($toTranslate)); } $labels[$k] = $label; } static::$mergedLabels[static::class] = $labels; } return static::$mergedLabels[static::class]; }
[ "public", "function", "mergeAttributeLabels", "(", "$", "labels", ")", "{", "if", "(", "!", "isset", "(", "static", "::", "$", "mergedLabels", "[", "static", "::", "class", "]", ")", ")", "{", "$", "default", "=", "$", "this", "->", "defaultAttributeLabe...
Merge Attribute labels for Model.
[ "Merge", "Attribute", "labels", "for", "Model", "." ]
090eb4b95dd731b338cd661b569f6b9b999f95e4
https://github.com/hiqdev/hipanel-core/blob/090eb4b95dd731b338cd661b569f6b9b999f95e4/src/base/Model.php#L86-L110
train
hiqdev/hipanel-core
src/widgets/LinkSorter.php
LinkSorter.renderSortLinks
protected function renderSortLinks() { $attributes = empty($this->attributes) ? array_keys($this->sort->attributes) : $this->attributes; $links = []; foreach ($attributes as $name) { $links[] = $this->sort->link($name); } return $this->render('LinkSorterView', [ 'id' => $this->id, 'links' => $links, 'attributes' => $this->sort->attributes, 'options' => array_merge($this->options, ['encode' => false]), 'containerClass' => $this->containerClass, 'buttonClass' => $this->buttonClass, 'uiModel' => $this->uiModel, ]); }
php
protected function renderSortLinks() { $attributes = empty($this->attributes) ? array_keys($this->sort->attributes) : $this->attributes; $links = []; foreach ($attributes as $name) { $links[] = $this->sort->link($name); } return $this->render('LinkSorterView', [ 'id' => $this->id, 'links' => $links, 'attributes' => $this->sort->attributes, 'options' => array_merge($this->options, ['encode' => false]), 'containerClass' => $this->containerClass, 'buttonClass' => $this->buttonClass, 'uiModel' => $this->uiModel, ]); }
[ "protected", "function", "renderSortLinks", "(", ")", "{", "$", "attributes", "=", "empty", "(", "$", "this", "->", "attributes", ")", "?", "array_keys", "(", "$", "this", "->", "sort", "->", "attributes", ")", ":", "$", "this", "->", "attributes", ";", ...
Renders the sort links. @return string the rendering result
[ "Renders", "the", "sort", "links", "." ]
090eb4b95dd731b338cd661b569f6b9b999f95e4
https://github.com/hiqdev/hipanel-core/blob/090eb4b95dd731b338cd661b569f6b9b999f95e4/src/widgets/LinkSorter.php#L48-L65
train
hiqdev/hipanel-core
src/widgets/ChartOptions.php
ChartOptions.initDefaults
protected function initDefaults() { $id = $this->getId(); $this->hiddenInputs = ArrayHelper::merge([ 'id' => ['value' => null, 'options' => []], 'from' => ['value' => null, 'options' => []], 'till' => ['value' => null, 'options' => []], ], $this->hiddenInputs); $this->form = ArrayHelper::merge([ 'action' => '#', 'method' => 'post', 'options' => [ 'class' => ['form-inline', $this->getId()], ], ], $this->form); $this->pickerOptions = ArrayHelper::merge([ 'class' => DateRangePicker::class, 'name' => '', 'options' => [ 'tag' => false, 'id' => "{$id}-period-btn", ], 'clientEvents' => [ 'apply.daterangepicker' => new JsExpression(/** @lang JavaScript */" function (event, picker) { var form = $(picker.element[0]).closest('form'); var span = form.find('#{$id}-period-btn span'); span.text(picker.startDate.format('ll') + ' - ' + picker.endDate.format('ll')); form.find('input[name=from]').val(picker.startDate.format()); form.find('input[name=till]').val(picker.endDate.format()); form.trigger('change.updateChart'); } "), 'cancel.daterangepicker' => new JsExpression(/** @lang JavaScript */" function (event, picker) { var form = $(event.element[0]).closest('form'); var span = form.find('#{$id}-period-btn span'); span.text(span.data('prompt')); form.find('input[name=from]').val(''); form.find('input[name=till]').val(''); form.trigger('change.updateChart'); } "), ], 'clientOptions' => [ 'ranges' => [ Yii::t('hipanel', 'Current Month') => new JsExpression('[moment().startOf("month"), new Date()]'), Yii::t('hipanel', 'Previous Month') => new JsExpression('[moment().subtract(1, "month").startOf("month"), moment().subtract(1, "month").endOf("month")]'), Yii::t('hipanel', 'Last 3 months') => new JsExpression('[moment().subtract(3, "month").startOf("month"), new Date()]'), Yii::t('hipanel', 'Last year') => new JsExpression('[moment().subtract(1, "year").startOf("year"), new Date()]'), ], ], ], $this->pickerOptions); }
php
protected function initDefaults() { $id = $this->getId(); $this->hiddenInputs = ArrayHelper::merge([ 'id' => ['value' => null, 'options' => []], 'from' => ['value' => null, 'options' => []], 'till' => ['value' => null, 'options' => []], ], $this->hiddenInputs); $this->form = ArrayHelper::merge([ 'action' => '#', 'method' => 'post', 'options' => [ 'class' => ['form-inline', $this->getId()], ], ], $this->form); $this->pickerOptions = ArrayHelper::merge([ 'class' => DateRangePicker::class, 'name' => '', 'options' => [ 'tag' => false, 'id' => "{$id}-period-btn", ], 'clientEvents' => [ 'apply.daterangepicker' => new JsExpression(/** @lang JavaScript */" function (event, picker) { var form = $(picker.element[0]).closest('form'); var span = form.find('#{$id}-period-btn span'); span.text(picker.startDate.format('ll') + ' - ' + picker.endDate.format('ll')); form.find('input[name=from]').val(picker.startDate.format()); form.find('input[name=till]').val(picker.endDate.format()); form.trigger('change.updateChart'); } "), 'cancel.daterangepicker' => new JsExpression(/** @lang JavaScript */" function (event, picker) { var form = $(event.element[0]).closest('form'); var span = form.find('#{$id}-period-btn span'); span.text(span.data('prompt')); form.find('input[name=from]').val(''); form.find('input[name=till]').val(''); form.trigger('change.updateChart'); } "), ], 'clientOptions' => [ 'ranges' => [ Yii::t('hipanel', 'Current Month') => new JsExpression('[moment().startOf("month"), new Date()]'), Yii::t('hipanel', 'Previous Month') => new JsExpression('[moment().subtract(1, "month").startOf("month"), moment().subtract(1, "month").endOf("month")]'), Yii::t('hipanel', 'Last 3 months') => new JsExpression('[moment().subtract(3, "month").startOf("month"), new Date()]'), Yii::t('hipanel', 'Last year') => new JsExpression('[moment().subtract(1, "year").startOf("year"), new Date()]'), ], ], ], $this->pickerOptions); }
[ "protected", "function", "initDefaults", "(", ")", "{", "$", "id", "=", "$", "this", "->", "getId", "(", ")", ";", "$", "this", "->", "hiddenInputs", "=", "ArrayHelper", "::", "merge", "(", "[", "'id'", "=>", "[", "'value'", "=>", "null", ",", "'opti...
Initializes default values for the widget properties. @void
[ "Initializes", "default", "values", "for", "the", "widget", "properties", "." ]
090eb4b95dd731b338cd661b569f6b9b999f95e4
https://github.com/hiqdev/hipanel-core/blob/090eb4b95dd731b338cd661b569f6b9b999f95e4/src/widgets/ChartOptions.php#L105-L165
train
hiqdev/hipanel-core
src/widgets/ChartOptions.php
ChartOptions.registerClientScript
protected function registerClientScript() { $id = $this->getId(); $options = Json::encode($this->ajaxOptions); $this->getView()->registerJs(/** @lang JavaScript */" $('.{$id}').on('change.updateChart', function (event) { var defaultOptions = { url: $(this).attr('action'), data: $(this).serializeArray(), type: 'post', success: function (html) { $('.{$id}-chart-wrapper').closest('.box').find('.box-body').html(html); } }; event.preventDefault(); var options = $.extend(defaultOptions, $options, true) $.ajax(options); }); "); }
php
protected function registerClientScript() { $id = $this->getId(); $options = Json::encode($this->ajaxOptions); $this->getView()->registerJs(/** @lang JavaScript */" $('.{$id}').on('change.updateChart', function (event) { var defaultOptions = { url: $(this).attr('action'), data: $(this).serializeArray(), type: 'post', success: function (html) { $('.{$id}-chart-wrapper').closest('.box').find('.box-body').html(html); } }; event.preventDefault(); var options = $.extend(defaultOptions, $options, true) $.ajax(options); }); "); }
[ "protected", "function", "registerClientScript", "(", ")", "{", "$", "id", "=", "$", "this", "->", "getId", "(", ")", ";", "$", "options", "=", "Json", "::", "encode", "(", "$", "this", "->", "ajaxOptions", ")", ";", "$", "this", "->", "getView", "("...
Registers JS event listener to re-draw the chart upon demand. @void @see ajaxOptions
[ "Registers", "JS", "event", "listener", "to", "re", "-", "draw", "the", "chart", "upon", "demand", "." ]
090eb4b95dd731b338cd661b569f6b9b999f95e4
https://github.com/hiqdev/hipanel-core/blob/090eb4b95dd731b338cd661b569f6b9b999f95e4/src/widgets/ChartOptions.php#L279-L298
train
hiqdev/hipanel-core
src/actions/RedirectAction.php
RedirectAction.getUrl
public function getUrl() { if ($this->_url instanceof Closure) { return call_user_func($this->_url, $this); } return $this->_url ?: Yii::$app->request->referrer; }
php
public function getUrl() { if ($this->_url instanceof Closure) { return call_user_func($this->_url, $this); } return $this->_url ?: Yii::$app->request->referrer; }
[ "public", "function", "getUrl", "(", ")", "{", "if", "(", "$", "this", "->", "_url", "instanceof", "Closure", ")", "{", "return", "call_user_func", "(", "$", "this", "->", "_url", ",", "$", "this", ")", ";", "}", "return", "$", "this", "->", "_url", ...
Collects the URL array, executing callable functions. @return string|array default return to previous page (referer)
[ "Collects", "the", "URL", "array", "executing", "callable", "functions", "." ]
090eb4b95dd731b338cd661b569f6b9b999f95e4
https://github.com/hiqdev/hipanel-core/blob/090eb4b95dd731b338cd661b569f6b9b999f95e4/src/actions/RedirectAction.php#L32-L39
train
hiqdev/hipanel-core
src/filters/EasyAccessControl.php
EasyAccessControl.init
public function init() { parent::init(); if ($this->user !== false) { $this->user = Instance::ensure($this->user, User::class); } }
php
public function init() { parent::init(); if ($this->user !== false) { $this->user = Instance::ensure($this->user, User::class); } }
[ "public", "function", "init", "(", ")", "{", "parent", "::", "init", "(", ")", ";", "if", "(", "$", "this", "->", "user", "!==", "false", ")", "{", "$", "this", "->", "user", "=", "Instance", "::", "ensure", "(", "$", "this", "->", "user", ",", ...
Initializes user.
[ "Initializes", "user", "." ]
090eb4b95dd731b338cd661b569f6b9b999f95e4
https://github.com/hiqdev/hipanel-core/blob/090eb4b95dd731b338cd661b569f6b9b999f95e4/src/filters/EasyAccessControl.php#L61-L67
train
hiqdev/hipanel-core
src/helpers/Url.php
Url.toSearch
public static function toSearch(string $modelName, array $params = [], string $action = 'index') { $formName = Inflector::id2camel($modelName) . 'Search'; return static::toAction($modelName, [$formName => $params], $action); }
php
public static function toSearch(string $modelName, array $params = [], string $action = 'index') { $formName = Inflector::id2camel($modelName) . 'Search'; return static::toAction($modelName, [$formName => $params], $action); }
[ "public", "static", "function", "toSearch", "(", "string", "$", "modelName", ",", "array", "$", "params", "=", "[", "]", ",", "string", "$", "action", "=", "'index'", ")", "{", "$", "formName", "=", "Inflector", "::", "id2camel", "(", "$", "modelName", ...
Build search url. @param string $modelName @param array $params @param string $action @return array|string
[ "Build", "search", "url", "." ]
090eb4b95dd731b338cd661b569f6b9b999f95e4
https://github.com/hiqdev/hipanel-core/blob/090eb4b95dd731b338cd661b569f6b9b999f95e4/src/helpers/Url.php#L43-L48
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/Priloha.php
Priloha.getDownloadUrl
public static function getDownloadUrl($object) { $urlParts = parse_url($object->apiURL); $pathParts = pathinfo($urlParts['path']); return $urlParts['scheme'].'://'.$urlParts['host'] .( array_key_exists('port',$urlParts) ? ':'.$urlParts['port'] : '') .$pathParts['dirname'].'/'.$pathParts['filename'].'/content'; }
php
public static function getDownloadUrl($object) { $urlParts = parse_url($object->apiURL); $pathParts = pathinfo($urlParts['path']); return $urlParts['scheme'].'://'.$urlParts['host'] .( array_key_exists('port',$urlParts) ? ':'.$urlParts['port'] : '') .$pathParts['dirname'].'/'.$pathParts['filename'].'/content'; }
[ "public", "static", "function", "getDownloadUrl", "(", "$", "object", ")", "{", "$", "urlParts", "=", "parse_url", "(", "$", "object", "->", "apiURL", ")", ";", "$", "pathParts", "=", "pathinfo", "(", "$", "urlParts", "[", "'path'", "]", ")", ";", "ret...
Obtain url for Attachment Download @param FlexiBeeRO $object Source object @return string url
[ "Obtain", "url", "for", "Attachment", "Download" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/Priloha.php#L75-L80
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/Priloha.php
Priloha.getFirstAttachment
public static function getFirstAttachment($object) { $attachments = self::getAttachmentsList($object); return count($attachments) ? current($attachments) : null; }
php
public static function getFirstAttachment($object) { $attachments = self::getAttachmentsList($object); return count($attachments) ? current($attachments) : null; }
[ "public", "static", "function", "getFirstAttachment", "(", "$", "object", ")", "{", "$", "attachments", "=", "self", "::", "getAttachmentsList", "(", "$", "object", ")", ";", "return", "count", "(", "$", "attachments", ")", "?", "current", "(", "$", "attac...
Obtain first attachment for given object @param FlexiBeeRO $object @return array
[ "Obtain", "first", "attachment", "for", "given", "object" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/Priloha.php#L88-L92
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/Priloha.php
Priloha.getAttachment
public static function getAttachment($attachmentID,$options = []) { $result = null; $downloader = new Priloha($attachmentID,$options); if ($downloader->lastResponseCode == 200) { $downloader->doCurlRequest(self::getDownloadURL($downloader), 'GET'); if ($downloader->lastResponseCode == 200) { $result = $downloader->lastCurlResponse; } } return $result; }
php
public static function getAttachment($attachmentID,$options = []) { $result = null; $downloader = new Priloha($attachmentID,$options); if ($downloader->lastResponseCode == 200) { $downloader->doCurlRequest(self::getDownloadURL($downloader), 'GET'); if ($downloader->lastResponseCode == 200) { $result = $downloader->lastCurlResponse; } } return $result; }
[ "public", "static", "function", "getAttachment", "(", "$", "attachmentID", ",", "$", "options", "=", "[", "]", ")", "{", "$", "result", "=", "null", ";", "$", "downloader", "=", "new", "Priloha", "(", "$", "attachmentID", ",", "$", "options", ")", ";",...
Gives you attachment body as return value @param int $attachmentID @param array $options Additional Connection Options @return string
[ "Gives", "you", "attachment", "body", "as", "return", "value" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/Priloha.php#L102-L114
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/Priloha.php
Priloha.download
public static function download($object, $format = 'pdf', $attachmentID = null) { $attachments = self::getAttachmentsList($object); if (isset($attachmentID) && !array_key_exists($attachmentID, $attachments)) { $object->addStatusMessage(sprintf(_('Attagment %s does no exist'), $attachmentID), 'warning'); } $attachmentBody = $object->doCurlRequest(self::getDownloadUrl($object), 'GET'); header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Disposition: attachment; filename='.$object->getEvidence().'_'.$object.'.'.$format); header('Content-Length: '.strlen($attachmentBody)); echo $attachmentBody; }
php
public static function download($object, $format = 'pdf', $attachmentID = null) { $attachments = self::getAttachmentsList($object); if (isset($attachmentID) && !array_key_exists($attachmentID, $attachments)) { $object->addStatusMessage(sprintf(_('Attagment %s does no exist'), $attachmentID), 'warning'); } $attachmentBody = $object->doCurlRequest(self::getDownloadUrl($object), 'GET'); header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Disposition: attachment; filename='.$object->getEvidence().'_'.$object.'.'.$format); header('Content-Length: '.strlen($attachmentBody)); echo $attachmentBody; }
[ "public", "static", "function", "download", "(", "$", "object", ",", "$", "format", "=", "'pdf'", ",", "$", "attachmentID", "=", "null", ")", "{", "$", "attachments", "=", "self", "::", "getAttachmentsList", "(", "$", "object", ")", ";", "if", "(", "is...
Send "download" headers first and then file itself @param FlexiBeeRO $object @param int|string $attachmentID
[ "Send", "download", "headers", "first", "and", "then", "file", "itself" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/Priloha.php#L122-L144
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/Priloha.php
Priloha.saveToFile
public static function saveToFile($attachmentID, $destination) { $result = 0; $downloader = new Priloha($attachmentID); if ($downloader->lastResponseCode == 200) { $downloader->doCurlRequest(self::getDownloadURL($downloader), 'GET'); if ($downloader->lastResponseCode == 200) { if (is_dir($destination)) { $destination .= '/'.$downloader->getDataValue('nazSoub'); } $result = file_put_contents($destination, $downloader->lastCurlResponse); } } return $result; }
php
public static function saveToFile($attachmentID, $destination) { $result = 0; $downloader = new Priloha($attachmentID); if ($downloader->lastResponseCode == 200) { $downloader->doCurlRequest(self::getDownloadURL($downloader), 'GET'); if ($downloader->lastResponseCode == 200) { if (is_dir($destination)) { $destination .= '/'.$downloader->getDataValue('nazSoub'); } $result = file_put_contents($destination, $downloader->lastCurlResponse); } } return $result; }
[ "public", "static", "function", "saveToFile", "(", "$", "attachmentID", ",", "$", "destination", ")", "{", "$", "result", "=", "0", ";", "$", "downloader", "=", "new", "Priloha", "(", "$", "attachmentID", ")", ";", "if", "(", "$", "downloader", "->", "...
Save attachment to file @param int $attachmentID @param string $destination directory or filename with path @return int
[ "Save", "attachment", "to", "file" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/Priloha.php#L153-L169
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/Priloha.php
Priloha.addAttachmentFromFile
public static function addAttachmentFromFile($object, $filename) { return self::addAttachment($object, basename($filename), file_get_contents($filename), mime_content_type($filename)); }
php
public static function addAttachmentFromFile($object, $filename) { return self::addAttachment($object, basename($filename), file_get_contents($filename), mime_content_type($filename)); }
[ "public", "static", "function", "addAttachmentFromFile", "(", "$", "object", ",", "$", "filename", ")", "{", "return", "self", "::", "addAttachment", "(", "$", "object", ",", "basename", "(", "$", "filename", ")", ",", "file_get_contents", "(", "$", "filenam...
Add Attachment from File @param FlexiBeeRW $object @param string $filename @return int HTTP response code
[ "Add", "Attachment", "from", "File" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/Priloha.php#L179-L183
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/Priloha.php
Priloha.getAttachmentsList
public static function getAttachmentsList($object) { $fburl = $object->getFlexiBeeURL(); $attachments = []; $oFormat = $object->format; $object->setFormat('json'); $atch = $object->getFlexiData($fburl.'/prilohy'.(count($object->defaultUrlParams) ? '?'.http_build_query($object->defaultUrlParams) : '')); $object->setFormat($oFormat); if (count($atch) && ($object->lastResponseCode == 200)) { foreach ($atch as $attachmentID => $attachmentData) { $attachments[$attachmentID] = $attachmentData; $attachments[$attachmentID]['url'] = $object->url.'/c/'.$object->company.'/priloha/'.$attachmentData['id']; } } return $attachments; }
php
public static function getAttachmentsList($object) { $fburl = $object->getFlexiBeeURL(); $attachments = []; $oFormat = $object->format; $object->setFormat('json'); $atch = $object->getFlexiData($fburl.'/prilohy'.(count($object->defaultUrlParams) ? '?'.http_build_query($object->defaultUrlParams) : '')); $object->setFormat($oFormat); if (count($atch) && ($object->lastResponseCode == 200)) { foreach ($atch as $attachmentID => $attachmentData) { $attachments[$attachmentID] = $attachmentData; $attachments[$attachmentID]['url'] = $object->url.'/c/'.$object->company.'/priloha/'.$attachmentData['id']; } } return $attachments; }
[ "public", "static", "function", "getAttachmentsList", "(", "$", "object", ")", "{", "$", "fburl", "=", "$", "object", "->", "getFlexiBeeURL", "(", ")", ";", "$", "attachments", "=", "[", "]", ";", "$", "oFormat", "=", "$", "object", "->", "format", ";"...
Obtain Record related attachments list @param FlexiBeeRO $object @return array
[ "Obtain", "Record", "related", "attachments", "list" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/Priloha.php#L215-L231
train
hiqdev/hipanel-core
src/helpers/FileHelper.php
FileHelper.getContentMimeType
public static function getContentMimeType($content) { $finfo = finfo_open(FILEINFO_MIME_TYPE); $mimeType = finfo_buffer($finfo, $content); finfo_close($finfo); return $mimeType; }
php
public static function getContentMimeType($content) { $finfo = finfo_open(FILEINFO_MIME_TYPE); $mimeType = finfo_buffer($finfo, $content); finfo_close($finfo); return $mimeType; }
[ "public", "static", "function", "getContentMimeType", "(", "$", "content", ")", "{", "$", "finfo", "=", "finfo_open", "(", "FILEINFO_MIME_TYPE", ")", ";", "$", "mimeType", "=", "finfo_buffer", "(", "$", "finfo", ",", "$", "content", ")", ";", "finfo_close", ...
Returns the MIME-type of content in string. @param string $content @return string Content mime-type
[ "Returns", "the", "MIME", "-", "type", "of", "content", "in", "string", "." ]
090eb4b95dd731b338cd661b569f6b9b999f95e4
https://github.com/hiqdev/hipanel-core/blob/090eb4b95dd731b338cd661b569f6b9b999f95e4/src/helpers/FileHelper.php#L23-L30
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/Adresar.php
Adresar.getNotificationEmailAddress
public function getNotificationEmailAddress() { $email = null; $emailsRaw = $this->getFlexiData($this->getApiURL(), ['detail' => 'custom:id,email,kontakty(primarni,email)', 'relations' => 'kontakty']); if (is_array($emailsRaw) && !empty($emailsRaw[0])) { $emails = $emailsRaw[0]; if (array_key_exists('email', $emails) && strlen(trim($emails['email']))) { $email = $emails['email']; } if (array_key_exists('kontakty', $emails) && !empty($emails['kontakty'])) { foreach ($emails['kontakty'] as $kontakt) { if (($kontakt['primarni'] == 'true') && strlen(trim($kontakt['email']))) { $email = $kontakt['email']; break; } } } } return $email; }
php
public function getNotificationEmailAddress() { $email = null; $emailsRaw = $this->getFlexiData($this->getApiURL(), ['detail' => 'custom:id,email,kontakty(primarni,email)', 'relations' => 'kontakty']); if (is_array($emailsRaw) && !empty($emailsRaw[0])) { $emails = $emailsRaw[0]; if (array_key_exists('email', $emails) && strlen(trim($emails['email']))) { $email = $emails['email']; } if (array_key_exists('kontakty', $emails) && !empty($emails['kontakty'])) { foreach ($emails['kontakty'] as $kontakt) { if (($kontakt['primarni'] == 'true') && strlen(trim($kontakt['email']))) { $email = $kontakt['email']; break; } } } } return $email; }
[ "public", "function", "getNotificationEmailAddress", "(", ")", "{", "$", "email", "=", "null", ";", "$", "emailsRaw", "=", "$", "this", "->", "getFlexiData", "(", "$", "this", "->", "getApiURL", "(", ")", ",", "[", "'detail'", "=>", "'custom:id,email,kontakt...
get Email address for Customer with primary contact prefered @return string email of primary contact or address email or null
[ "get", "Email", "address", "for", "Customer", "with", "primary", "contact", "prefered" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/Adresar.php#L32-L52
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/Adresar.php
Adresar.getCellPhoneNumber
public function getCellPhoneNumber() { $mobil = null; $mobilsRaw = $this->getFlexiData($this->getApiURL(), ['detail' => 'custom:id,mobil,kontakty(primarni,mobil)', 'relations' => 'kontakty']); if (is_array($mobilsRaw)) { $mobils = $mobilsRaw[0]; if (array_key_exists('mobil', $mobils) && strlen(trim($mobils['mobil']))) { $mobil = $mobils['mobil']; } if (array_key_exists('kontakty', $mobils) && !empty($mobils['kontakty'])) { foreach ($mobils['kontakty'] as $kontakt) { if (($kontakt['primarni'] == 'true') && strlen(trim($kontakt['mobil']))) { $mobil = $kontakt['mobil']; break; } } } } return $mobil; }
php
public function getCellPhoneNumber() { $mobil = null; $mobilsRaw = $this->getFlexiData($this->getApiURL(), ['detail' => 'custom:id,mobil,kontakty(primarni,mobil)', 'relations' => 'kontakty']); if (is_array($mobilsRaw)) { $mobils = $mobilsRaw[0]; if (array_key_exists('mobil', $mobils) && strlen(trim($mobils['mobil']))) { $mobil = $mobils['mobil']; } if (array_key_exists('kontakty', $mobils) && !empty($mobils['kontakty'])) { foreach ($mobils['kontakty'] as $kontakt) { if (($kontakt['primarni'] == 'true') && strlen(trim($kontakt['mobil']))) { $mobil = $kontakt['mobil']; break; } } } } return $mobil; }
[ "public", "function", "getCellPhoneNumber", "(", ")", "{", "$", "mobil", "=", "null", ";", "$", "mobilsRaw", "=", "$", "this", "->", "getFlexiData", "(", "$", "this", "->", "getApiURL", "(", ")", ",", "[", "'detail'", "=>", "'custom:id,mobil,kontakty(primarn...
get cell phone Number for Customer with primary contact prefered @return string cell phone number of primary contact or address cell number or null
[ "get", "cell", "phone", "Number", "for", "Customer", "with", "primary", "contact", "prefered" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/Adresar.php#L59-L79
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/Adresar.php
Adresar.getAnyPhoneNumber
public function getAnyPhoneNumber() { $phoneNo = null; $numbersRaw = $this->getFlexiData($this->getApiURL(), ['detail' => 'custom:id,mobil,tel,kontakty(primarni,mobil,tel)', 'relations' => 'kontakty']); if (is_array($numbersRaw) && !empty($numbersRaw[0])) { $numbers = $numbersRaw[0]; if (array_key_exists('mobil', $numbers) && strlen(trim($numbers['mobil']))) { $phoneNo = $numbers['mobil']; } if (array_key_exists('tel', $numbers) && strlen(trim($numbers['tel']))) { $phoneNo = $numbers['tel']; } if (array_key_exists('kontakty', $numbers) && !empty($numbers['kontakty'])) { foreach ($numbers['kontakty'] as $kontakt) { if ($kontakt['primarni'] == 'true') { } if (strlen(trim($kontakt['mobil']))) { $phoneNo = $kontakt['mobil']; break; } elseif (strlen(trim($kontakt['mobil']))) { $phoneNo = $kontakt['mobil']; break; } } } } return $phoneNo; }
php
public function getAnyPhoneNumber() { $phoneNo = null; $numbersRaw = $this->getFlexiData($this->getApiURL(), ['detail' => 'custom:id,mobil,tel,kontakty(primarni,mobil,tel)', 'relations' => 'kontakty']); if (is_array($numbersRaw) && !empty($numbersRaw[0])) { $numbers = $numbersRaw[0]; if (array_key_exists('mobil', $numbers) && strlen(trim($numbers['mobil']))) { $phoneNo = $numbers['mobil']; } if (array_key_exists('tel', $numbers) && strlen(trim($numbers['tel']))) { $phoneNo = $numbers['tel']; } if (array_key_exists('kontakty', $numbers) && !empty($numbers['kontakty'])) { foreach ($numbers['kontakty'] as $kontakt) { if ($kontakt['primarni'] == 'true') { } if (strlen(trim($kontakt['mobil']))) { $phoneNo = $kontakt['mobil']; break; } elseif (strlen(trim($kontakt['mobil']))) { $phoneNo = $kontakt['mobil']; break; } } } } return $phoneNo; }
[ "public", "function", "getAnyPhoneNumber", "(", ")", "{", "$", "phoneNo", "=", "null", ";", "$", "numbersRaw", "=", "$", "this", "->", "getFlexiData", "(", "$", "this", "->", "getApiURL", "(", ")", ",", "[", "'detail'", "=>", "'custom:id,mobil,tel,kontakty(p...
get any phone Number for Customer with primary contact prefered @return string phone number of primary contact or address's phone number or null
[ "get", "any", "phone", "Number", "for", "Customer", "with", "primary", "contact", "prefered" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/Adresar.php#L86-L115
train
hiqdev/hipanel-core
src/components/SettingsStorage.php
SettingsStorage.perform
private function perform($action, $data) { if ($this->app->user->isGuest) { return []; } return Client::perform($action, $data); }
php
private function perform($action, $data) { if ($this->app->user->isGuest) { return []; } return Client::perform($action, $data); }
[ "private", "function", "perform", "(", "$", "action", ",", "$", "data", ")", "{", "if", "(", "$", "this", "->", "app", "->", "user", "->", "isGuest", ")", "{", "return", "[", "]", ";", "}", "return", "Client", "::", "perform", "(", "$", "action", ...
Performs request to the API. @param string $key @param array $value @return array
[ "Performs", "request", "to", "the", "API", "." ]
090eb4b95dd731b338cd661b569f6b9b999f95e4
https://github.com/hiqdev/hipanel-core/blob/090eb4b95dd731b338cd661b569f6b9b999f95e4/src/components/SettingsStorage.php#L85-L92
train
hiqdev/hipanel-core
src/grid/MainColumn.php
MainColumn.buildUrl
public function buildUrl($url) { if (strncmp($url, '/', 1) === 0) { return $url; } $baseUrl = isset($this->grid->controllerUrl) ? $this->grid->controllerUrl : ''; return $baseUrl ? Url::to($baseUrl . '/' . $url) : Url::to($url); }
php
public function buildUrl($url) { if (strncmp($url, '/', 1) === 0) { return $url; } $baseUrl = isset($this->grid->controllerUrl) ? $this->grid->controllerUrl : ''; return $baseUrl ? Url::to($baseUrl . '/' . $url) : Url::to($url); }
[ "public", "function", "buildUrl", "(", "$", "url", ")", "{", "if", "(", "strncmp", "(", "$", "url", ",", "'/'", ",", "1", ")", "===", "0", ")", "{", "return", "$", "url", ";", "}", "$", "baseUrl", "=", "isset", "(", "$", "this", "->", "grid", ...
Builds url. @param string $url @return string
[ "Builds", "url", "." ]
090eb4b95dd731b338cd661b569f6b9b999f95e4
https://github.com/hiqdev/hipanel-core/blob/090eb4b95dd731b338cd661b569f6b9b999f95e4/src/grid/MainColumn.php#L49-L57
train
hiqdev/hipanel-core
src/grid/MainColumn.php
MainColumn.renderNoteLink
public function renderNoteLink($model, $key, $index) { return $this->note ? Html::tag('span', Yii::t('hipanel', 'Note') . ': ', ['class' => 'bold']) . XEditable::widget([ 'model' => $model, 'attribute' => $this->note === true ? 'note' : $this->note, 'pluginOptions' => $this->noteOptions, ]) : null; }
php
public function renderNoteLink($model, $key, $index) { return $this->note ? Html::tag('span', Yii::t('hipanel', 'Note') . ': ', ['class' => 'bold']) . XEditable::widget([ 'model' => $model, 'attribute' => $this->note === true ? 'note' : $this->note, 'pluginOptions' => $this->noteOptions, ]) : null; }
[ "public", "function", "renderNoteLink", "(", "$", "model", ",", "$", "key", ",", "$", "index", ")", "{", "return", "$", "this", "->", "note", "?", "Html", "::", "tag", "(", "'span'", ",", "Yii", "::", "t", "(", "'hipanel'", ",", "'Note'", ")", ".",...
Renders link to edit note. @param $model @param $key @param $index @return string|null
[ "Renders", "link", "to", "edit", "note", "." ]
090eb4b95dd731b338cd661b569f6b9b999f95e4
https://github.com/hiqdev/hipanel-core/blob/090eb4b95dd731b338cd661b569f6b9b999f95e4/src/grid/MainColumn.php#L107-L114
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/Company.php
Company.saveBackupTo
public function saveBackupTo($filename) { $result = false; $headersBackup = $this->defaultHttpHeaders; $this->defaultHttpHeaders['Accept'] = '*/*'; $this->defaultHttpHeaders['Content-Type'] = 'application/x-winstrom-backup'; $this->performRequest('backup', 'GET'); $this->defaultHttpHeaders = $headersBackup; if ($this->lastResponseCode == 200) { if (file_put_contents($filename, $this->lastCurlResponse)) { $result = true; } } $this->defaultHttpHeaders = $headersBackup; return $result; }
php
public function saveBackupTo($filename) { $result = false; $headersBackup = $this->defaultHttpHeaders; $this->defaultHttpHeaders['Accept'] = '*/*'; $this->defaultHttpHeaders['Content-Type'] = 'application/x-winstrom-backup'; $this->performRequest('backup', 'GET'); $this->defaultHttpHeaders = $headersBackup; if ($this->lastResponseCode == 200) { if (file_put_contents($filename, $this->lastCurlResponse)) { $result = true; } } $this->defaultHttpHeaders = $headersBackup; return $result; }
[ "public", "function", "saveBackupTo", "(", "$", "filename", ")", "{", "$", "result", "=", "false", ";", "$", "headersBackup", "=", "$", "this", "->", "defaultHttpHeaders", ";", "$", "this", "->", "defaultHttpHeaders", "[", "'Accept'", "]", "=", "'*/*'", ";...
Save company backup to file @param string $filename @return boolean was backup saved to file ?
[ "Save", "company", "backup", "to", "file" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/Company.php#L159-L175
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/Company.php
Company.restoreBackupFrom
public function restoreBackupFrom($filename, $name = null, $disableEet = false, $disableAutoSendMail = false, $disableWebHooks = false) { $options = []; if (!empty($name)) { $options['name'] = $name; } if ($disableEet === true) { $options['disableEet'] = 1; } if ($disableAutoSendMail === true) { $options['disableAutoSendMail'] = 1; } if ($disableWebHooks === true) { $options['disableWebHooks'] = 1; } $headersBackup = $this->defaultHttpHeaders; $this->defaultHttpHeaders['Accept'] = '*/*'; $this->defaultHttpHeaders['Content-Type'] = 'application/x-winstrom-backup'; $this->setPostFields(file_get_contents($filename)); $this->performRequest('restore'.(empty($options) ? '' : '?'.http_build_query($options) ), 'PUT'); return $this->lastResponseCode == 200; }
php
public function restoreBackupFrom($filename, $name = null, $disableEet = false, $disableAutoSendMail = false, $disableWebHooks = false) { $options = []; if (!empty($name)) { $options['name'] = $name; } if ($disableEet === true) { $options['disableEet'] = 1; } if ($disableAutoSendMail === true) { $options['disableAutoSendMail'] = 1; } if ($disableWebHooks === true) { $options['disableWebHooks'] = 1; } $headersBackup = $this->defaultHttpHeaders; $this->defaultHttpHeaders['Accept'] = '*/*'; $this->defaultHttpHeaders['Content-Type'] = 'application/x-winstrom-backup'; $this->setPostFields(file_get_contents($filename)); $this->performRequest('restore'.(empty($options) ? '' : '?'.http_build_query($options) ), 'PUT'); return $this->lastResponseCode == 200; }
[ "public", "function", "restoreBackupFrom", "(", "$", "filename", ",", "$", "name", "=", "null", ",", "$", "disableEet", "=", "false", ",", "$", "disableAutoSendMail", "=", "false", ",", "$", "disableWebHooks", "=", "false", ")", "{", "$", "options", "=", ...
Restore company from given file @link https://www.flexibee.eu/api/dokumentace/ref/restore-backup/ Obnovení ze zálohy @param string $filename *.winstrom-backup file @param string $name Extra name for restored company @param boolean $disableEet Disable EET on restored company @param boolean $disableAutoSendMail Dsable auto sending of all documents @param boolean $disableWebHooks Remove Registered webhooks @return boolean restore result
[ "Restore", "company", "from", "given", "file" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/Company.php#L190-L216
train
hiqdev/hipanel-core
src/helpers/ArrayHelper.php
ArrayHelper.csplit
public static function csplit($string, $delimiter = ',') { if (is_array($string)) { return $string; } $res = []; foreach (explode($delimiter, $string) as $k => $v) { $v = trim($v); if (strlen($v)) { array_push($res, $v); } } return $res; }
php
public static function csplit($string, $delimiter = ',') { if (is_array($string)) { return $string; } $res = []; foreach (explode($delimiter, $string) as $k => $v) { $v = trim($v); if (strlen($v)) { array_push($res, $v); } } return $res; }
[ "public", "static", "function", "csplit", "(", "$", "string", ",", "$", "delimiter", "=", "','", ")", "{", "if", "(", "is_array", "(", "$", "string", ")", ")", "{", "return", "$", "string", ";", "}", "$", "res", "=", "[", "]", ";", "foreach", "("...
Parses data, exploding the string by comma, trying to create array. @param $string @param string $delimiter @return array
[ "Parses", "data", "exploding", "the", "string", "by", "comma", "trying", "to", "create", "array", "." ]
090eb4b95dd731b338cd661b569f6b9b999f95e4
https://github.com/hiqdev/hipanel-core/blob/090eb4b95dd731b338cd661b569f6b9b999f95e4/src/helpers/ArrayHelper.php#L37-L51
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FakturaVydana.php
FakturaVydana.vytvorVazbuZDD
public function vytvorVazbuZDD($income) { switch (get_class($income)) { case 'FlexiPeeHP\\Banka': $modul = 'banka'; break; case 'FlexiPeeHP\\PokladniPohyb': $modul = 'pokladna'; break; default : throw new \Ease\Exception(_('Unsupported $income parameter type')); } $incomeId = $income->getRecordID(); $myId = $this->getRecordID(); $headersBackup = $this->defaultHttpHeaders; $this->defaultHttpHeaders['Accept'] = 'text/html'; $this->setPostFields(http_build_query(['modul' => $modul, 'submit' => 'OK'])); $this->performRequest($myId.'/vytvor-vazbu-zdd/'.$incomeId, 'GET', 'json'); $responseArr = explode("\n", $this->lastCurlResponse); $result = true; $message = ''; foreach ($responseArr as $lineNo => $responseLine) { if (strstr($responseLine, '<ul class = "flexibee-errors">')) { $message = trim($responseArr[$lineNo + 1]); $result = false; } if (strstr($responseLine, '<div class = "alert alert-success">')) { $message = strip_tags(html_entity_decode(trim($responseArr[$lineNo + 1]))); $result = true; } } if ($result === true) { $this->addStatusMessage(empty($message) ? $this->getDataValue('kod').'/vytvor-vazbu-zdd/'.$income->getRecordCode() : $message, 'success'); } else { $this->addStatusMessage($this->getDataValue('kod').'/vytvor-vazbu-zdd/'.$incomeId, 'warning'); } $this->defaultHttpHeaders = $headersBackup; return $result; }
php
public function vytvorVazbuZDD($income) { switch (get_class($income)) { case 'FlexiPeeHP\\Banka': $modul = 'banka'; break; case 'FlexiPeeHP\\PokladniPohyb': $modul = 'pokladna'; break; default : throw new \Ease\Exception(_('Unsupported $income parameter type')); } $incomeId = $income->getRecordID(); $myId = $this->getRecordID(); $headersBackup = $this->defaultHttpHeaders; $this->defaultHttpHeaders['Accept'] = 'text/html'; $this->setPostFields(http_build_query(['modul' => $modul, 'submit' => 'OK'])); $this->performRequest($myId.'/vytvor-vazbu-zdd/'.$incomeId, 'GET', 'json'); $responseArr = explode("\n", $this->lastCurlResponse); $result = true; $message = ''; foreach ($responseArr as $lineNo => $responseLine) { if (strstr($responseLine, '<ul class = "flexibee-errors">')) { $message = trim($responseArr[$lineNo + 1]); $result = false; } if (strstr($responseLine, '<div class = "alert alert-success">')) { $message = strip_tags(html_entity_decode(trim($responseArr[$lineNo + 1]))); $result = true; } } if ($result === true) { $this->addStatusMessage(empty($message) ? $this->getDataValue('kod').'/vytvor-vazbu-zdd/'.$income->getRecordCode() : $message, 'success'); } else { $this->addStatusMessage($this->getDataValue('kod').'/vytvor-vazbu-zdd/'.$incomeId, 'warning'); } $this->defaultHttpHeaders = $headersBackup; return $result; }
[ "public", "function", "vytvorVazbuZDD", "(", "$", "income", ")", "{", "switch", "(", "get_class", "(", "$", "income", ")", ")", "{", "case", "'FlexiPeeHP\\\\Banka'", ":", "$", "modul", "=", "'banka'", ";", "break", ";", "case", "'FlexiPeeHP\\\\PokladniPohyb'",...
add link to advance tax document @param Banka|PokladniPohyb $income Income payment document @return boolean success @throws Exception
[ "add", "link", "to", "advance", "tax", "document" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FakturaVydana.php#L155-L205
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/FakturaVydana.php
FakturaVydana.overdueDays
static public function overdueDays($dueDate) { $dateDiff = date_diff(is_object($dueDate) ? $dueDate : FlexiBeeRO::flexiDateToDateTime($dueDate), new \DateTime()); if ($dateDiff->invert == 1) { $ddif = $dateDiff->days * -1; } else { $ddif = $dateDiff->days; } return $ddif; }
php
static public function overdueDays($dueDate) { $dateDiff = date_diff(is_object($dueDate) ? $dueDate : FlexiBeeRO::flexiDateToDateTime($dueDate), new \DateTime()); if ($dateDiff->invert == 1) { $ddif = $dateDiff->days * -1; } else { $ddif = $dateDiff->days; } return $ddif; }
[ "static", "public", "function", "overdueDays", "(", "$", "dueDate", ")", "{", "$", "dateDiff", "=", "date_diff", "(", "is_object", "(", "$", "dueDate", ")", "?", "$", "dueDate", ":", "FlexiBeeRO", "::", "flexiDateToDateTime", "(", "$", "dueDate", ")", ",",...
Get Number of days overdue @param string $dueDate FlexiBee date @return int
[ "Get", "Number", "of", "days", "overdue" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/FakturaVydana.php#L241-L252
train
hiqdev/hipanel-core
src/widgets/ModalButton.php
ModalButton.initOptions
protected function initOptions() { if (!($this->model instanceof Model)) { throw new InvalidConfigException('Model is required'); } if (!($this->model->getPrimaryKey())) { throw new InvalidConfigException('Model has empty primary key'); } if ($this->button !== false) { $this->button['position'] = isset($this->button['position']) ? $this->button['position'] : static::BUTTON_OUTSIDE; } if (empty($this->scenario)) { $this->scenario = $this->model->scenario; } else { $this->_oldScenario = $this->model->scenario; $this->model->scenario = $this->scenario; } if ($this->form !== false) { $formConfig = [ 'method' => 'POST', 'action' => $this->scenario, 'options' => [ 'class' => 'inline', 'data' => [ 'modal-form' => true, ], ], ]; if ($this->submit === static::SUBMIT_PJAX) { $formConfig['options'] = ArrayHelper::merge($formConfig['options'], [ 'data' => ['pjax' => 1, 'pjax-push' => 0], ]); } elseif ($this->submit === static::SUBMIT_AJAX) { $formConfig['options'] = ArrayHelper::merge($formConfig['options'], [ 'data' => ['ajax-submit' => 1], ]); $this->registerAjaxSubmit(); } $this->form = ArrayHelper::merge($formConfig, $this->form); } if (is_array($footer = $this->modal['footer'])) { $tag = ArrayHelper::remove($footer, 'tag', 'input'); $label = ArrayHelper::remove($footer, 'label', 'OK'); $footer = ArrayHelper::merge([ 'data-modal-submit' => true, 'data-loading-text' => '<i class="fa fa-circle-o-notch fa-spin"></i> ' . Yii::t('hipanel', 'loading'), ], $footer); if ($tag === 'input') { $footer['type'] = 'submit'; $footer['value'] = $label; } $this->modal['footer'] = Html::tag($tag, $label, $footer); $this->registerFooterButtonScript(); } $this->modal = ArrayHelper::merge([ 'id' => $this->getModalId(), 'toggleButton' => ($this->button['position'] === static::BUTTON_IN_MODAL) ? $this->button : false, ], $this->modal); }
php
protected function initOptions() { if (!($this->model instanceof Model)) { throw new InvalidConfigException('Model is required'); } if (!($this->model->getPrimaryKey())) { throw new InvalidConfigException('Model has empty primary key'); } if ($this->button !== false) { $this->button['position'] = isset($this->button['position']) ? $this->button['position'] : static::BUTTON_OUTSIDE; } if (empty($this->scenario)) { $this->scenario = $this->model->scenario; } else { $this->_oldScenario = $this->model->scenario; $this->model->scenario = $this->scenario; } if ($this->form !== false) { $formConfig = [ 'method' => 'POST', 'action' => $this->scenario, 'options' => [ 'class' => 'inline', 'data' => [ 'modal-form' => true, ], ], ]; if ($this->submit === static::SUBMIT_PJAX) { $formConfig['options'] = ArrayHelper::merge($formConfig['options'], [ 'data' => ['pjax' => 1, 'pjax-push' => 0], ]); } elseif ($this->submit === static::SUBMIT_AJAX) { $formConfig['options'] = ArrayHelper::merge($formConfig['options'], [ 'data' => ['ajax-submit' => 1], ]); $this->registerAjaxSubmit(); } $this->form = ArrayHelper::merge($formConfig, $this->form); } if (is_array($footer = $this->modal['footer'])) { $tag = ArrayHelper::remove($footer, 'tag', 'input'); $label = ArrayHelper::remove($footer, 'label', 'OK'); $footer = ArrayHelper::merge([ 'data-modal-submit' => true, 'data-loading-text' => '<i class="fa fa-circle-o-notch fa-spin"></i> ' . Yii::t('hipanel', 'loading'), ], $footer); if ($tag === 'input') { $footer['type'] = 'submit'; $footer['value'] = $label; } $this->modal['footer'] = Html::tag($tag, $label, $footer); $this->registerFooterButtonScript(); } $this->modal = ArrayHelper::merge([ 'id' => $this->getModalId(), 'toggleButton' => ($this->button['position'] === static::BUTTON_IN_MODAL) ? $this->button : false, ], $this->modal); }
[ "protected", "function", "initOptions", "(", ")", "{", "if", "(", "!", "(", "$", "this", "->", "model", "instanceof", "Model", ")", ")", "{", "throw", "new", "InvalidConfigException", "(", "'Model is required'", ")", ";", "}", "if", "(", "!", "(", "$", ...
Initialization of options. @throws InvalidConfigException
[ "Initialization", "of", "options", "." ]
090eb4b95dd731b338cd661b569f6b9b999f95e4
https://github.com/hiqdev/hipanel-core/blob/090eb4b95dd731b338cd661b569f6b9b999f95e4/src/widgets/ModalButton.php#L162-L230
train
hiqdev/hipanel-core
src/widgets/ModalButton.php
ModalButton.run
public function run() { $this->endModal(); if ($this->form !== false) { $this->endForm(); } if ($this->_oldScenario !== null) { $this->model->scenario = $this->_oldScenario; } }
php
public function run() { $this->endModal(); if ($this->form !== false) { $this->endForm(); } if ($this->_oldScenario !== null) { $this->model->scenario = $this->_oldScenario; } }
[ "public", "function", "run", "(", ")", "{", "$", "this", "->", "endModal", "(", ")", ";", "if", "(", "$", "this", "->", "form", "!==", "false", ")", "{", "$", "this", "->", "endForm", "(", ")", ";", "}", "if", "(", "$", "this", "->", "_oldScena...
Runs widget.
[ "Runs", "widget", "." ]
090eb4b95dd731b338cd661b569f6b9b999f95e4
https://github.com/hiqdev/hipanel-core/blob/090eb4b95dd731b338cd661b569f6b9b999f95e4/src/widgets/ModalButton.php#L235-L246
train
hiqdev/hipanel-core
src/widgets/ModalButton.php
ModalButton.renderButton
public function renderButton() { if (($button = $this->button) !== false) { $tag = ArrayHelper::remove($button, 'tag', 'a'); $label = ArrayHelper::remove($button, 'label', Inflector::camel2words(Inflector::id2camel($this->scenario))); if ($tag === 'button' && !isset($button['type'])) { $toggleButton['type'] = 'button'; } if ($button['disabled']) { $button = ArrayHelper::merge([ 'onClick' => new JsExpression('return false'), ], $button); } else { $button = ArrayHelper::merge([ 'data-toggle' => 'modal', 'data-target' => "#{$this->getModalId()}", ], $button); } if ($tag === 'a' && empty($button['href'])) { $button['href'] = '#'; } echo Html::tag($tag, $label, $button); } }
php
public function renderButton() { if (($button = $this->button) !== false) { $tag = ArrayHelper::remove($button, 'tag', 'a'); $label = ArrayHelper::remove($button, 'label', Inflector::camel2words(Inflector::id2camel($this->scenario))); if ($tag === 'button' && !isset($button['type'])) { $toggleButton['type'] = 'button'; } if ($button['disabled']) { $button = ArrayHelper::merge([ 'onClick' => new JsExpression('return false'), ], $button); } else { $button = ArrayHelper::merge([ 'data-toggle' => 'modal', 'data-target' => "#{$this->getModalId()}", ], $button); } if ($tag === 'a' && empty($button['href'])) { $button['href'] = '#'; } echo Html::tag($tag, $label, $button); } }
[ "public", "function", "renderButton", "(", ")", "{", "if", "(", "(", "$", "button", "=", "$", "this", "->", "button", ")", "!==", "false", ")", "{", "$", "tag", "=", "ArrayHelper", "::", "remove", "(", "$", "button", ",", "'tag'", ",", "'a'", ")", ...
Renders toggle button.
[ "Renders", "toggle", "button", "." ]
090eb4b95dd731b338cd661b569f6b9b999f95e4
https://github.com/hiqdev/hipanel-core/blob/090eb4b95dd731b338cd661b569f6b9b999f95e4/src/widgets/ModalButton.php#L251-L278
train
hiqdev/hipanel-core
src/widgets/ModalButton.php
ModalButton.beginForm
public function beginForm() { $this->form = ActiveForm::begin($this->form); $inputId = $this->getModalId() . '-hidden-value'; echo Html::activeHiddenInput($this->model, 'id', ['id' => $inputId]); }
php
public function beginForm() { $this->form = ActiveForm::begin($this->form); $inputId = $this->getModalId() . '-hidden-value'; echo Html::activeHiddenInput($this->model, 'id', ['id' => $inputId]); }
[ "public", "function", "beginForm", "(", ")", "{", "$", "this", "->", "form", "=", "ActiveForm", "::", "begin", "(", "$", "this", "->", "form", ")", ";", "$", "inputId", "=", "$", "this", "->", "getModalId", "(", ")", ".", "'-hidden-value'", ";", "ech...
Begins form.
[ "Begins", "form", "." ]
090eb4b95dd731b338cd661b569f6b9b999f95e4
https://github.com/hiqdev/hipanel-core/blob/090eb4b95dd731b338cd661b569f6b9b999f95e4/src/widgets/ModalButton.php#L298-L304
train
hiqdev/hipanel-core
src/widgets/ModalButton.php
ModalButton.registerAjaxSubmit
public function registerAjaxSubmit() { $view = Yii::$app->view; $options = ArrayHelper::merge([ 'type' => new JsExpression("form.attr('method')"), 'url' => new JsExpression("form.attr('action')"), 'data' => new JsExpression('form.serialize()'), ], $this->ajaxOptions); $options = Json::encode($options); $view->registerJs(<<<JS $('form[data-ajax-submit]').on('submit', function(event) { var form = $(this); if (event.eventPhase === 2) { $.ajax($options); $('.modal-backdrop').remove(); } event.preventDefault(); }); JS ); }
php
public function registerAjaxSubmit() { $view = Yii::$app->view; $options = ArrayHelper::merge([ 'type' => new JsExpression("form.attr('method')"), 'url' => new JsExpression("form.attr('action')"), 'data' => new JsExpression('form.serialize()'), ], $this->ajaxOptions); $options = Json::encode($options); $view->registerJs(<<<JS $('form[data-ajax-submit]').on('submit', function(event) { var form = $(this); if (event.eventPhase === 2) { $.ajax($options); $('.modal-backdrop').remove(); } event.preventDefault(); }); JS ); }
[ "public", "function", "registerAjaxSubmit", "(", ")", "{", "$", "view", "=", "Yii", "::", "$", "app", "->", "view", ";", "$", "options", "=", "ArrayHelper", "::", "merge", "(", "[", "'type'", "=>", "new", "JsExpression", "(", "\"form.attr('method')\"", ")"...
Registers JavaScript for ajax submit.
[ "Registers", "JavaScript", "for", "ajax", "submit", "." ]
090eb4b95dd731b338cd661b569f6b9b999f95e4
https://github.com/hiqdev/hipanel-core/blob/090eb4b95dd731b338cd661b569f6b9b999f95e4/src/widgets/ModalButton.php#L333-L355
train
hiqdev/hipanel-core
src/actions/Action.php
Action.getCollection
public function getCollection() { if ($this->parent) { return $this->parent->getCollection(); } if (!is_object($this->_collection)) { $action = $this->controller->action; if ($action instanceof self) { $scenario = $action->getScenario(); } else { $scenario = $action->id; } $this->_collection = Yii::createObject(ArrayHelper::merge([ 'class' => Collection::class, 'model' => $this->controller->newModel(['scenario' => $scenario]), 'scenario' => $scenario, 'queryOptions' => $this->queryOptions, ], (array) $this->_collection)); } return $this->_collection; }
php
public function getCollection() { if ($this->parent) { return $this->parent->getCollection(); } if (!is_object($this->_collection)) { $action = $this->controller->action; if ($action instanceof self) { $scenario = $action->getScenario(); } else { $scenario = $action->id; } $this->_collection = Yii::createObject(ArrayHelper::merge([ 'class' => Collection::class, 'model' => $this->controller->newModel(['scenario' => $scenario]), 'scenario' => $scenario, 'queryOptions' => $this->queryOptions, ], (array) $this->_collection)); } return $this->_collection; }
[ "public", "function", "getCollection", "(", ")", "{", "if", "(", "$", "this", "->", "parent", ")", "{", "return", "$", "this", "->", "parent", "->", "getCollection", "(", ")", ";", "}", "if", "(", "!", "is_object", "(", "$", "this", "->", "_collectio...
Gets the instance of the collection. @return Collection
[ "Gets", "the", "instance", "of", "the", "collection", "." ]
090eb4b95dd731b338cd661b569f6b9b999f95e4
https://github.com/hiqdev/hipanel-core/blob/090eb4b95dd731b338cd661b569f6b9b999f95e4/src/actions/Action.php#L97-L120
train
hiqdev/hipanel-core
src/actions/Action.php
Action.perform
public function perform() { $this->beforePerform(); $this->loadCollection(); try { $error = !$this->saveCollection(); if ($error === true && $this->collection->hasErrors()) { $error = $this->collection->getFirstError(); } } catch (ResponseErrorException $e) { $error = $e->getMessage(); } catch (InvalidCallException $e) { $error = $e->getMessage(); } $this->afterPerform(); return $error; }
php
public function perform() { $this->beforePerform(); $this->loadCollection(); try { $error = !$this->saveCollection(); if ($error === true && $this->collection->hasErrors()) { $error = $this->collection->getFirstError(); } } catch (ResponseErrorException $e) { $error = $e->getMessage(); } catch (InvalidCallException $e) { $error = $e->getMessage(); } $this->afterPerform(); return $error; }
[ "public", "function", "perform", "(", ")", "{", "$", "this", "->", "beforePerform", "(", ")", ";", "$", "this", "->", "loadCollection", "(", ")", ";", "try", "{", "$", "error", "=", "!", "$", "this", "->", "saveCollection", "(", ")", ";", "if", "("...
Performs action. @return boolean|string Whether save is success - boolean true or sting - an error - false - no errors
[ "Performs", "action", "." ]
090eb4b95dd731b338cd661b569f6b9b999f95e4
https://github.com/hiqdev/hipanel-core/blob/090eb4b95dd731b338cd661b569f6b9b999f95e4/src/actions/Action.php#L199-L220
train
hiqdev/hipanel-core
src/actions/Action.php
Action.getModelClass
public function getModelClass() { if (isset($this->parent)) { return $this->parent->getModelClass(); } if (isset($this->getCollection()->first)) { return $this->getCollection()->first->class; } return get_class($this->getCollection()->getModel()); }
php
public function getModelClass() { if (isset($this->parent)) { return $this->parent->getModelClass(); } if (isset($this->getCollection()->first)) { return $this->getCollection()->first->class; } return get_class($this->getCollection()->getModel()); }
[ "public", "function", "getModelClass", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "parent", ")", ")", "{", "return", "$", "this", "->", "parent", "->", "getModelClass", "(", ")", ";", "}", "if", "(", "isset", "(", "$", "this", "->",...
Return the model class name. @return string
[ "Return", "the", "model", "class", "name", "." ]
090eb4b95dd731b338cd661b569f6b9b999f95e4
https://github.com/hiqdev/hipanel-core/blob/090eb4b95dd731b338cd661b569f6b9b999f95e4/src/actions/Action.php#L235-L246
train
hiqdev/hipanel-core
src/actions/Action.php
Action.prepareData
public function prepareData($data = []) { return (array) ($this->data instanceof Closure ? call_user_func($this->data, $this, $data) : $this->data); }
php
public function prepareData($data = []) { return (array) ($this->data instanceof Closure ? call_user_func($this->data, $this, $data) : $this->data); }
[ "public", "function", "prepareData", "(", "$", "data", "=", "[", "]", ")", "{", "return", "(", "array", ")", "(", "$", "this", "->", "data", "instanceof", "Closure", "?", "call_user_func", "(", "$", "this", "->", "data", ",", "$", "this", ",", "$", ...
Prepares additional data for render. @param $data array Additional data, prepared by other classes. Optional. @return array
[ "Prepares", "additional", "data", "for", "render", "." ]
090eb4b95dd731b338cd661b569f6b9b999f95e4
https://github.com/hiqdev/hipanel-core/blob/090eb4b95dd731b338cd661b569f6b9b999f95e4/src/actions/Action.php#L262-L265
train
hiqdev/hipanel-core
src/actions/Action.php
Action.addFlash
public function addFlash($type, $error = null) { if ($type === 'error' && is_string($error) && !empty($error)) { $text = Yii::t('hipanel', $error); } else { $text = $this->getFlashText($type); } if ($type instanceof Closure) { $text = call_user_func($text, $text, $this); } Yii::$app->session->addFlash($type, [ 'text' => $text, ]); }
php
public function addFlash($type, $error = null) { if ($type === 'error' && is_string($error) && !empty($error)) { $text = Yii::t('hipanel', $error); } else { $text = $this->getFlashText($type); } if ($type instanceof Closure) { $text = call_user_func($text, $text, $this); } Yii::$app->session->addFlash($type, [ 'text' => $text, ]); }
[ "public", "function", "addFlash", "(", "$", "type", ",", "$", "error", "=", "null", ")", "{", "if", "(", "$", "type", "===", "'error'", "&&", "is_string", "(", "$", "error", ")", "&&", "!", "empty", "(", "$", "error", ")", ")", "{", "$", "text", ...
Adds flash message. @param string $type the type of flash @param string $error the text of error
[ "Adds", "flash", "message", "." ]
090eb4b95dd731b338cd661b569f6b9b999f95e4
https://github.com/hiqdev/hipanel-core/blob/090eb4b95dd731b338cd661b569f6b9b999f95e4/src/actions/Action.php#L299-L314
train
hiqdev/hipanel-core
src/actions/SmartUpdateAction.php
SmartUpdateAction.fetchModels
public function fetchModels() { $this->beforeFetchLoad(); $dataProvider = $this->getDataProvider(); $this->beforeFetch(); return $dataProvider->getModels(); }
php
public function fetchModels() { $this->beforeFetchLoad(); $dataProvider = $this->getDataProvider(); $this->beforeFetch(); return $dataProvider->getModels(); }
[ "public", "function", "fetchModels", "(", ")", "{", "$", "this", "->", "beforeFetchLoad", "(", ")", ";", "$", "dataProvider", "=", "$", "this", "->", "getDataProvider", "(", ")", ";", "$", "this", "->", "beforeFetch", "(", ")", ";", "return", "$", "dat...
Fetches models that will be edited. @throws BadRequestHttpException @return Model[]
[ "Fetches", "models", "that", "will", "be", "edited", "." ]
090eb4b95dd731b338cd661b569f6b9b999f95e4
https://github.com/hiqdev/hipanel-core/blob/090eb4b95dd731b338cd661b569f6b9b999f95e4/src/actions/SmartUpdateAction.php#L239-L246
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/SkladovyPohybPolozka.php
SkladovyPohybPolozka.addSerialNumber
public function addSerialNumber($number, $isMain = false) { $numberBranch['kod'] = $number; $crrentSerialNumbers = $this->getDataValue('vyrobniCislaPrijata'); if ($isMain) { if (!empty($crrentSerialNumbers)) { foreach (array_keys($crrentSerialNumbers) as $serialNumberID) { unset($this->data['vyrobniCislaPrijata'][$serialNumberID]['vyrobnicislohlav']); } } $numberBranch['vyrobnicislohlav'] = 1; } $this->setDataValue('mnozMj', count($crrentSerialNumbers) + 1); return $this->addArrayToBranch($numberBranch, 'vyrobniCislaPrijata'); }
php
public function addSerialNumber($number, $isMain = false) { $numberBranch['kod'] = $number; $crrentSerialNumbers = $this->getDataValue('vyrobniCislaPrijata'); if ($isMain) { if (!empty($crrentSerialNumbers)) { foreach (array_keys($crrentSerialNumbers) as $serialNumberID) { unset($this->data['vyrobniCislaPrijata'][$serialNumberID]['vyrobnicislohlav']); } } $numberBranch['vyrobnicislohlav'] = 1; } $this->setDataValue('mnozMj', count($crrentSerialNumbers) + 1); return $this->addArrayToBranch($numberBranch, 'vyrobniCislaPrijata'); }
[ "public", "function", "addSerialNumber", "(", "$", "number", ",", "$", "isMain", "=", "false", ")", "{", "$", "numberBranch", "[", "'kod'", "]", "=", "$", "number", ";", "$", "crrentSerialNumbers", "=", "$", "this", "->", "getDataValue", "(", "'vyrobniCisl...
Add Items Serial Number @param string $number serial number @param boolean $isMain main number @return boolean Success
[ "Add", "Items", "Serial", "Number" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/SkladovyPohybPolozka.php#L35-L49
train
hiqdev/hipanel-core
src/widgets/ArraySpoiler.php
ArraySpoiler.renderButtonSpoiler
protected function renderButtonSpoiler() { $options = ArrayHelper::merge([ 'role' => 'button', 'data-spoiler-group' => 'main', 'data-spoiler-toggle' => true, 'data-target' => $this->button['id'] . '-body', ], $this->button); $label = $this->getButtonLabel(ArrayHelper::remove($options, 'label')); $this->parts['{button}'] = Html::tag(ArrayHelper::remove($options, 'tag'), $label, $options); $this->getView()->registerJs(" $('[data-spoiler-toggle]').click(function (e) { $('#'+$(this).data('target')).toggle(); $('[data-spoiler-group=\"{$options['data-spoiler-group']}\"]').not($(this)).trigger('hide'); }).on('hide', function () { $('#'+$(this).data('target')).hide(); })", View::POS_READY); }
php
protected function renderButtonSpoiler() { $options = ArrayHelper::merge([ 'role' => 'button', 'data-spoiler-group' => 'main', 'data-spoiler-toggle' => true, 'data-target' => $this->button['id'] . '-body', ], $this->button); $label = $this->getButtonLabel(ArrayHelper::remove($options, 'label')); $this->parts['{button}'] = Html::tag(ArrayHelper::remove($options, 'tag'), $label, $options); $this->getView()->registerJs(" $('[data-spoiler-toggle]').click(function (e) { $('#'+$(this).data('target')).toggle(); $('[data-spoiler-group=\"{$options['data-spoiler-group']}\"]').not($(this)).trigger('hide'); }).on('hide', function () { $('#'+$(this).data('target')).hide(); })", View::POS_READY); }
[ "protected", "function", "renderButtonSpoiler", "(", ")", "{", "$", "options", "=", "ArrayHelper", "::", "merge", "(", "[", "'role'", "=>", "'button'", ",", "'data-spoiler-group'", "=>", "'main'", ",", "'data-spoiler-toggle'", "=>", "true", ",", "'data-target'", ...
Renders a button for spoiler activator. Additional special options, that will be extracted from [[$this->button]]: - `data-popover-group` - Group of popovers. Is used to close all other popovers in group, when new one is opening. Default: 'main' @see http://getbootstrap.com/javascript/#popovers-options
[ "Renders", "a", "button", "for", "spoiler", "activator", "." ]
090eb4b95dd731b338cd661b569f6b9b999f95e4
https://github.com/hiqdev/hipanel-core/blob/090eb4b95dd731b338cd661b569f6b9b999f95e4/src/widgets/ArraySpoiler.php#L286-L306
train
hiqdev/hipanel-core
src/widgets/ArraySpoiler.php
ArraySpoiler.renderHiddenSpoiler
public function renderHiddenSpoiler() { $options = ArrayHelper::merge([ 'id' => $this->button['id'] . '-body', 'tag' => 'span', 'value' => implode($this->hiddenDelimiter ?? $this->delimiter, $this->getSpoiledItems()), 'class' => 'collapse', 'data-spoiler-body' => true, ], $this->hidden); $this->parts['{hidden}'] = Html::tag(ArrayHelper::remove($options, 'tag'), ArrayHelper::remove($options, 'value'), $options); }
php
public function renderHiddenSpoiler() { $options = ArrayHelper::merge([ 'id' => $this->button['id'] . '-body', 'tag' => 'span', 'value' => implode($this->hiddenDelimiter ?? $this->delimiter, $this->getSpoiledItems()), 'class' => 'collapse', 'data-spoiler-body' => true, ], $this->hidden); $this->parts['{hidden}'] = Html::tag(ArrayHelper::remove($options, 'tag'), ArrayHelper::remove($options, 'value'), $options); }
[ "public", "function", "renderHiddenSpoiler", "(", ")", "{", "$", "options", "=", "ArrayHelper", "::", "merge", "(", "[", "'id'", "=>", "$", "this", "->", "button", "[", "'id'", "]", ".", "'-body'", ",", "'tag'", "=>", "'span'", ",", "'value'", "=>", "i...
Renders a spoiler-button-activated hidden part.
[ "Renders", "a", "spoiler", "-", "button", "-", "activated", "hidden", "part", "." ]
090eb4b95dd731b338cd661b569f6b9b999f95e4
https://github.com/hiqdev/hipanel-core/blob/090eb4b95dd731b338cd661b569f6b9b999f95e4/src/widgets/ArraySpoiler.php#L311-L322
train
hiqdev/hipanel-core
src/widgets/ArraySpoiler.php
ArraySpoiler.getButtonLabel
public function getButtonLabel($label) { if ($label instanceof Closure) { $label = call_user_func($label, $this); } else { $label = Yii::t('hipanel', $label, ['count' => count($this->getSpoiledItems())]); } return $label; }
php
public function getButtonLabel($label) { if ($label instanceof Closure) { $label = call_user_func($label, $this); } else { $label = Yii::t('hipanel', $label, ['count' => count($this->getSpoiledItems())]); } return $label; }
[ "public", "function", "getButtonLabel", "(", "$", "label", ")", "{", "if", "(", "$", "label", "instanceof", "Closure", ")", "{", "$", "label", "=", "call_user_func", "(", "$", "label", ",", "$", "this", ")", ";", "}", "else", "{", "$", "label", "=", ...
Returns the button label. @param $label string|Closure @return mixed|string
[ "Returns", "the", "button", "label", "." ]
090eb4b95dd731b338cd661b569f6b9b999f95e4
https://github.com/hiqdev/hipanel-core/blob/090eb4b95dd731b338cd661b569f6b9b999f95e4/src/widgets/ArraySpoiler.php#L330-L339
train
hiqdev/hipanel-core
src/widgets/ArraySpoiler.php
ArraySpoiler.run
public function run() { if (!isset($this->parts['{visible}'])) { $this->renderVisible(); } if (!isset($this->parts['{button}'])) { $this->renderSpoiled(); } if (!isset($this->parts['{hidden}'])) { $this->renderHidden(); } echo strtr($this->template, $this->parts); }
php
public function run() { if (!isset($this->parts['{visible}'])) { $this->renderVisible(); } if (!isset($this->parts['{button}'])) { $this->renderSpoiled(); } if (!isset($this->parts['{hidden}'])) { $this->renderHidden(); } echo strtr($this->template, $this->parts); }
[ "public", "function", "run", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "parts", "[", "'{visible}'", "]", ")", ")", "{", "$", "this", "->", "renderVisible", "(", ")", ";", "}", "if", "(", "!", "isset", "(", "$", "this", "->...
Renders the all the widget.
[ "Renders", "the", "all", "the", "widget", "." ]
090eb4b95dd731b338cd661b569f6b9b999f95e4
https://github.com/hiqdev/hipanel-core/blob/090eb4b95dd731b338cd661b569f6b9b999f95e4/src/widgets/ArraySpoiler.php#L344-L357
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/Stitek.php
Stitek.getLabels
public static function getLabels($object) { $labels = null; $labelsRaw = $object->getDataValue('stitky'); if (strlen($labelsRaw)) { $labels = is_array($labelsRaw) ? $labelsRaw : self::listToArray($labelsRaw); } return $labels; }
php
public static function getLabels($object) { $labels = null; $labelsRaw = $object->getDataValue('stitky'); if (strlen($labelsRaw)) { $labels = is_array($labelsRaw) ? $labelsRaw : self::listToArray($labelsRaw); } return $labels; }
[ "public", "static", "function", "getLabels", "(", "$", "object", ")", "{", "$", "labels", "=", "null", ";", "$", "labelsRaw", "=", "$", "object", "->", "getDataValue", "(", "'stitky'", ")", ";", "if", "(", "strlen", "(", "$", "labelsRaw", ")", ")", "...
Obtain labels for current record @deprecated since version 1.21 @param FlexiBeeRO $object data source @return array labels
[ "Obtain", "labels", "for", "current", "record" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/Stitek.php#L60-L69
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/Stitek.php
Stitek.listToArray
public static function listToArray($listRaw) { if (is_array($listRaw)) { $list = array_combine(array_values($listRaw), array_values($listRaw)); } else { if (strstr($listRaw, ',')) { $list = array_map('trim', explode(',', $listRaw)); } else { $list = [$listRaw]; } $list = array_combine($list, $list); } return empty($listRaw) ? [] : $list; }
php
public static function listToArray($listRaw) { if (is_array($listRaw)) { $list = array_combine(array_values($listRaw), array_values($listRaw)); } else { if (strstr($listRaw, ',')) { $list = array_map('trim', explode(',', $listRaw)); } else { $list = [$listRaw]; } $list = array_combine($list, $list); } return empty($listRaw) ? [] : $list; }
[ "public", "static", "function", "listToArray", "(", "$", "listRaw", ")", "{", "if", "(", "is_array", "(", "$", "listRaw", ")", ")", "{", "$", "list", "=", "array_combine", "(", "array_values", "(", "$", "listRaw", ")", ",", "array_values", "(", "$", "l...
Convert coma-separated list to array @param string $listRaw @return array
[ "Convert", "coma", "-", "separated", "list", "to", "array" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/Stitek.php#L78-L91
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/Stitek.php
Stitek.getAvailbleLabels
public static function getAvailbleLabels($object) { $labels = []; $evidenceBackup = $object->getEvidence(); $object->setEvidence('stitek'); $pathToVsb = array_flip(self::$vsbToEvidencePath); if (array_key_exists($evidenceBackup, $pathToVsb)) { $labelsRaw = $object->getColumnsFromFlexiBee(['kod', 'nazev'], [$pathToVsb[$evidenceBackup] => true], 'nazev'); if (count($labelsRaw)) { foreach ($labelsRaw as $labelInfo) { $labels[$labelInfo['kod']] = $labelInfo['nazev']; } } } $object->setEvidence($evidenceBackup); return $labels; }
php
public static function getAvailbleLabels($object) { $labels = []; $evidenceBackup = $object->getEvidence(); $object->setEvidence('stitek'); $pathToVsb = array_flip(self::$vsbToEvidencePath); if (array_key_exists($evidenceBackup, $pathToVsb)) { $labelsRaw = $object->getColumnsFromFlexiBee(['kod', 'nazev'], [$pathToVsb[$evidenceBackup] => true], 'nazev'); if (count($labelsRaw)) { foreach ($labelsRaw as $labelInfo) { $labels[$labelInfo['kod']] = $labelInfo['nazev']; } } } $object->setEvidence($evidenceBackup); return $labels; }
[ "public", "static", "function", "getAvailbleLabels", "(", "$", "object", ")", "{", "$", "labels", "=", "[", "]", ";", "$", "evidenceBackup", "=", "$", "object", "->", "getEvidence", "(", ")", ";", "$", "object", "->", "setEvidence", "(", "'stitek'", ")",...
Obtain list of availble labels for given object @param FlexiBeeRO $object @return array
[ "Obtain", "list", "of", "availble", "labels", "for", "given", "object" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/Stitek.php#L100-L119
train
Spoje-NET/FlexiPeeHP
src/FlexiPeeHP/Stitek.php
Stitek.createNew
public function createNew($name, $evidences, $options = []) { $this->setData($options, true); $evidence2code = array_flip(self::$vsbToEvidencePath); foreach ($evidences as $evidence) { if (array_key_exists($evidence, $evidence2code)) { $this->setDataValue($evidence2code[$evidence], true); } } if (!array_key_exists('kod', $options)) { $this->setDataValue('kod', self::code($name)); } $this->setDataValue('nazev', $name); return $this->sync(); }
php
public function createNew($name, $evidences, $options = []) { $this->setData($options, true); $evidence2code = array_flip(self::$vsbToEvidencePath); foreach ($evidences as $evidence) { if (array_key_exists($evidence, $evidence2code)) { $this->setDataValue($evidence2code[$evidence], true); } } if (!array_key_exists('kod', $options)) { $this->setDataValue('kod', self::code($name)); } $this->setDataValue('nazev', $name); return $this->sync(); }
[ "public", "function", "createNew", "(", "$", "name", ",", "$", "evidences", ",", "$", "options", "=", "[", "]", ")", "{", "$", "this", "->", "setData", "(", "$", "options", ",", "true", ")", ";", "$", "evidence2code", "=", "array_flip", "(", "self", ...
Create New Label for given evidencies @param string $name Label Name @param array $evidences Evidence code list ex: ['faktura-vydana','faktura-prijata'] @param array $options Additional Label properties ex: ['kod'=>'EXAMPLE','skupVybKlic'=>'SKUPINA_STITKU'] @return boolean success
[ "Create", "New", "Label", "for", "given", "evidencies" ]
8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73
https://github.com/Spoje-NET/FlexiPeeHP/blob/8c1d8d39e6d2d23a85ec5ef7afbb9f040fbaba73/src/FlexiPeeHP/Stitek.php#L168-L183
train
symbiote/silverstripe-multisites
src/Model/Site.php
Site.requireDefaultRecords
public function requireDefaultRecords() { parent::requireDefaultRecords(); if(Site::get()->count() > 0) { return; } $site = Site::create(); $site->Title = _t('Multisites.DEFAULTSITE', 'Default Site'); $site->IsDefault = true; $site->FolderID = Folder::find_or_make('default-site')->ID; $site->write(); $site->publish('Stage', 'Live'); DB::alteration_message('Default site created', 'created'); $pages = SiteTree::get()->exclude('ID', $site->ID)->filter('ParentID', 0); $count = count($pages); if ($count > 0) { foreach($pages as $page) { $page->ParentID = $site->ID; $page->write(); if ($page->isPublished()) { $page->publish('Stage', 'Live'); } } DB::alteration_message("Moved $count existing pages under new default site.", 'changed'); } }
php
public function requireDefaultRecords() { parent::requireDefaultRecords(); if(Site::get()->count() > 0) { return; } $site = Site::create(); $site->Title = _t('Multisites.DEFAULTSITE', 'Default Site'); $site->IsDefault = true; $site->FolderID = Folder::find_or_make('default-site')->ID; $site->write(); $site->publish('Stage', 'Live'); DB::alteration_message('Default site created', 'created'); $pages = SiteTree::get()->exclude('ID', $site->ID)->filter('ParentID', 0); $count = count($pages); if ($count > 0) { foreach($pages as $page) { $page->ParentID = $site->ID; $page->write(); if ($page->isPublished()) { $page->publish('Stage', 'Live'); } } DB::alteration_message("Moved $count existing pages under new default site.", 'changed'); } }
[ "public", "function", "requireDefaultRecords", "(", ")", "{", "parent", "::", "requireDefaultRecords", "(", ")", ";", "if", "(", "Site", "::", "get", "(", ")", "->", "count", "(", ")", ">", "0", ")", "{", "return", ";", "}", "$", "site", "=", "Site",...
Make sure there is a site record.
[ "Make", "sure", "there", "is", "a", "site", "record", "." ]
9b3fa1d3375ce073c050bd137b68766073efd458
https://github.com/symbiote/silverstripe-multisites/blob/9b3fa1d3375ce073c050bd137b68766073efd458/src/Model/Site.php#L236-L265
train
symbiote/silverstripe-multisites
src/Model/Site.php
Site.get_by_link
static public function get_by_link($link, $cache = true) { $current = Multisites::inst()->getCurrentSiteId(); if(trim($link, '/')) { $link = trim(Director::makeRelative($link), '/'); } else { $link = RootURLController::get_homepage_link(); } $parts = Convert::raw2sql(preg_split('|/+|', $link)); // Grab the initial root level page to traverse down from. $URLSegment = array_shift($parts); $sitetree = DataObject::get_one ( SiteTree::class, "\"URLSegment\" = '$URLSegment' AND \"ParentID\" = " . $current, $cache ); if (!$sitetree) { return false; } /// Fall back on a unique URLSegment for b/c. if(!$sitetree && self::nested_urls() && $page = DataObject::get(SiteTree::class, "\"URLSegment\" = '$URLSegment'")->First()) { return $page; } // Check if we have any more URL parts to parse. if(!count($parts)) return $sitetree; // Traverse down the remaining URL segments and grab the relevant SiteTree objects. foreach($parts as $segment) { $next = DataObject::get_one ( SiteTree::class, "\"URLSegment\" = '$segment' AND \"ParentID\" = $sitetree->ID", $cache ); if(!$next) { return false; } $sitetree->destroy(); $sitetree = $next; } return $sitetree; }
php
static public function get_by_link($link, $cache = true) { $current = Multisites::inst()->getCurrentSiteId(); if(trim($link, '/')) { $link = trim(Director::makeRelative($link), '/'); } else { $link = RootURLController::get_homepage_link(); } $parts = Convert::raw2sql(preg_split('|/+|', $link)); // Grab the initial root level page to traverse down from. $URLSegment = array_shift($parts); $sitetree = DataObject::get_one ( SiteTree::class, "\"URLSegment\" = '$URLSegment' AND \"ParentID\" = " . $current, $cache ); if (!$sitetree) { return false; } /// Fall back on a unique URLSegment for b/c. if(!$sitetree && self::nested_urls() && $page = DataObject::get(SiteTree::class, "\"URLSegment\" = '$URLSegment'")->First()) { return $page; } // Check if we have any more URL parts to parse. if(!count($parts)) return $sitetree; // Traverse down the remaining URL segments and grab the relevant SiteTree objects. foreach($parts as $segment) { $next = DataObject::get_one ( SiteTree::class, "\"URLSegment\" = '$segment' AND \"ParentID\" = $sitetree->ID", $cache ); if(!$next) { return false; } $sitetree->destroy(); $sitetree = $next; } return $sitetree; }
[ "static", "public", "function", "get_by_link", "(", "$", "link", ",", "$", "cache", "=", "true", ")", "{", "$", "current", "=", "Multisites", "::", "inst", "(", ")", "->", "getCurrentSiteId", "(", ")", ";", "if", "(", "trim", "(", "$", "link", ",", ...
Alternative implementation that takes into account the current site as the root @param type $link @param type $cache @return boolean
[ "Alternative", "implementation", "that", "takes", "into", "account", "the", "current", "site", "as", "the", "root" ]
9b3fa1d3375ce073c050bd137b68766073efd458
https://github.com/symbiote/silverstripe-multisites/blob/9b3fa1d3375ce073c050bd137b68766073efd458/src/Model/Site.php#L275-L320
train
symbiote/silverstripe-multisites
src/Model/Site.php
Site.getSiteTheme
public function getSiteTheme(){ $theme = $this->Theme; if (!$theme) { $theme = Config::inst()->get(SSViewer::class, 'theme'); } $this->extend('updateGetSiteTheme', $theme); return $theme; }
php
public function getSiteTheme(){ $theme = $this->Theme; if (!$theme) { $theme = Config::inst()->get(SSViewer::class, 'theme'); } $this->extend('updateGetSiteTheme', $theme); return $theme; }
[ "public", "function", "getSiteTheme", "(", ")", "{", "$", "theme", "=", "$", "this", "->", "Theme", ";", "if", "(", "!", "$", "theme", ")", "{", "$", "theme", "=", "Config", "::", "inst", "(", ")", "->", "get", "(", "SSViewer", "::", "class", ","...
Get the name of the theme applied to this site, allow extensions to override @return String
[ "Get", "the", "name", "of", "the", "theme", "applied", "to", "this", "site", "allow", "extensions", "to", "override" ]
9b3fa1d3375ce073c050bd137b68766073efd458
https://github.com/symbiote/silverstripe-multisites/blob/9b3fa1d3375ce073c050bd137b68766073efd458/src/Model/Site.php#L327-L334
train
symbiote/silverstripe-multisites
src/Model/Site.php
Site.hasFeature
public function hasFeature($feature){ if(!$this->DevID) return false; $sites = Config::inst()->get('Multisites', 'site_features'); if(!isset($sites[$this->DevID])) return false; $features = ArrayLib::valuekey($sites[$this->DevID]); if(!isset($features[$feature])) return false; return true; }
php
public function hasFeature($feature){ if(!$this->DevID) return false; $sites = Config::inst()->get('Multisites', 'site_features'); if(!isset($sites[$this->DevID])) return false; $features = ArrayLib::valuekey($sites[$this->DevID]); if(!isset($features[$feature])) return false; return true; }
[ "public", "function", "hasFeature", "(", "$", "feature", ")", "{", "if", "(", "!", "$", "this", "->", "DevID", ")", "return", "false", ";", "$", "sites", "=", "Config", "::", "inst", "(", ")", "->", "get", "(", "'Multisites'", ",", "'site_features'", ...
Checks to see if this site has a feature as defined in Muiltisites.site_features config @return Boolean
[ "Checks", "to", "see", "if", "this", "site", "has", "a", "feature", "as", "defined", "in", "Muiltisites", ".", "site_features", "config" ]
9b3fa1d3375ce073c050bd137b68766073efd458
https://github.com/symbiote/silverstripe-multisites/blob/9b3fa1d3375ce073c050bd137b68766073efd458/src/Model/Site.php#L341-L353
train
hryvinskyi/magento2-base
Plugin/DebugHints.php
DebugHints.afterCreate
public function afterCreate( TemplateEngineFactory $subject, TemplateEngineInterface $invocationResult ): TemplateEngineInterface { $storeCode = $this->storeManager->getStore()->getCode(); if ( $this->config->isEnabledLayoutDebug() && $this->request->getParam('hints') && $this->devHelper->isDevAllowed() ) { $showBlockHints = ( $this->scopeConfig->getValue( self::XML_PATH_DEBUG_TEMPLATE_HINTS_BLOCKS, ScopeInterface::SCOPE_STORE, $storeCode ) || $this->request->getParam('hints-block') ); return $this->debugHintsFactory->create([ 'subject' => $invocationResult, 'showBlockHints' => $showBlockHints, ]); } return $invocationResult; }
php
public function afterCreate( TemplateEngineFactory $subject, TemplateEngineInterface $invocationResult ): TemplateEngineInterface { $storeCode = $this->storeManager->getStore()->getCode(); if ( $this->config->isEnabledLayoutDebug() && $this->request->getParam('hints') && $this->devHelper->isDevAllowed() ) { $showBlockHints = ( $this->scopeConfig->getValue( self::XML_PATH_DEBUG_TEMPLATE_HINTS_BLOCKS, ScopeInterface::SCOPE_STORE, $storeCode ) || $this->request->getParam('hints-block') ); return $this->debugHintsFactory->create([ 'subject' => $invocationResult, 'showBlockHints' => $showBlockHints, ]); } return $invocationResult; }
[ "public", "function", "afterCreate", "(", "TemplateEngineFactory", "$", "subject", ",", "TemplateEngineInterface", "$", "invocationResult", ")", ":", "TemplateEngineInterface", "{", "$", "storeCode", "=", "$", "this", "->", "storeManager", "->", "getStore", "(", ")"...
Wrap template engine instance with the debugging hints decorator, depending of the store configuration @param TemplateEngineFactory $subject @param TemplateEngineInterface $invocationResult @return TemplateEngineInterface
[ "Wrap", "template", "engine", "instance", "with", "the", "debugging", "hints", "decorator", "depending", "of", "the", "store", "configuration" ]
7648c4d0c82a281c82aa1cf30d1808674ca40604
https://github.com/hryvinskyi/magento2-base/blob/7648c4d0c82a281c82aa1cf30d1808674ca40604/Plugin/DebugHints.php#L96-L121
train
symbiote/silverstripe-multisites
src/Admin/MultisitesModelAdminExtension.php
MultisitesModelAdminExtension.checkMultisitesAware
public function checkMultisitesAware() { // only true if using silverstripe-recipe <= 4.3.0 if (!$this->owner->hasMethod('getModelClass')) { $models = $this->owner->getManagedModels(); // throw error if any models use MultisitesAware extension foreach ($models as $model => $val) { if($model::has_extension(MultisitesAware::class)) { throw new \Exception( '`ModelAdmin::getModelClass()` missing. You are likely using `silverstripe-recipe:4.3.0` which introduced this bug. This can be fixed by updating to `silverstripe-recipe:4.3.1` or greater.' ); } } } }
php
public function checkMultisitesAware() { // only true if using silverstripe-recipe <= 4.3.0 if (!$this->owner->hasMethod('getModelClass')) { $models = $this->owner->getManagedModels(); // throw error if any models use MultisitesAware extension foreach ($models as $model => $val) { if($model::has_extension(MultisitesAware::class)) { throw new \Exception( '`ModelAdmin::getModelClass()` missing. You are likely using `silverstripe-recipe:4.3.0` which introduced this bug. This can be fixed by updating to `silverstripe-recipe:4.3.1` or greater.' ); } } } }
[ "public", "function", "checkMultisitesAware", "(", ")", "{", "// only true if using silverstripe-recipe <= 4.3.0", "if", "(", "!", "$", "this", "->", "owner", "->", "hasMethod", "(", "'getModelClass'", ")", ")", "{", "$", "models", "=", "$", "this", "->", "owner...
Prevents use of MultisitesAware extension when using silvestripe-recipe <= 4.3.0 @return void
[ "Prevents", "use", "of", "MultisitesAware", "extension", "when", "using", "silvestripe", "-", "recipe", "<", "=", "4", ".", "3", ".", "0" ]
9b3fa1d3375ce073c050bd137b68766073efd458
https://github.com/symbiote/silverstripe-multisites/blob/9b3fa1d3375ce073c050bd137b68766073efd458/src/Admin/MultisitesModelAdminExtension.php#L71-L84
train
symbiote/silverstripe-multisites
src/Admin/MultisitesModelAdminExtension.php
MultisitesModelAdminExtension.updateList
public function updateList(&$list){ if($this->modelIsMultiSitesAware()){ $site = $this->getActiveSite(); if ($site) { $list = $list->filter('SiteID', $site->ID); } } }
php
public function updateList(&$list){ if($this->modelIsMultiSitesAware()){ $site = $this->getActiveSite(); if ($site) { $list = $list->filter('SiteID', $site->ID); } } }
[ "public", "function", "updateList", "(", "&", "$", "list", ")", "{", "if", "(", "$", "this", "->", "modelIsMultiSitesAware", "(", ")", ")", "{", "$", "site", "=", "$", "this", "->", "getActiveSite", "(", ")", ";", "if", "(", "$", "site", ")", "{", ...
If this dataClass is MultisitesAware, filter the list by the current Multisites_ActiveSite
[ "If", "this", "dataClass", "is", "MultisitesAware", "filter", "the", "list", "by", "the", "current", "Multisites_ActiveSite" ]
9b3fa1d3375ce073c050bd137b68766073efd458
https://github.com/symbiote/silverstripe-multisites/blob/9b3fa1d3375ce073c050bd137b68766073efd458/src/Admin/MultisitesModelAdminExtension.php#L89-L96
train
symbiote/silverstripe-multisites
src/Admin/MultisitesModelAdminExtension.php
MultisitesModelAdminExtension.updateEditForm
public function updateEditForm($form){ if($this->modelIsMultiSitesAware()) { $managedSites = Multisites::inst()->sitesManagedByMember(); $source = Site::get()->filter('ID', Multisites::inst()->sitesManagedByMember())->map('ID', 'Title')->toArray(); $plural = singleton($this->owner->modelClass)->plural_name(); if(!count($source)){ $form->setFields(FieldList::create( LiteralField::create('NotAManager', "You do not have permission to manage $plural on any Sites") )); } } }
php
public function updateEditForm($form){ if($this->modelIsMultiSitesAware()) { $managedSites = Multisites::inst()->sitesManagedByMember(); $source = Site::get()->filter('ID', Multisites::inst()->sitesManagedByMember())->map('ID', 'Title')->toArray(); $plural = singleton($this->owner->modelClass)->plural_name(); if(!count($source)){ $form->setFields(FieldList::create( LiteralField::create('NotAManager', "You do not have permission to manage $plural on any Sites") )); } } }
[ "public", "function", "updateEditForm", "(", "$", "form", ")", "{", "if", "(", "$", "this", "->", "modelIsMultiSitesAware", "(", ")", ")", "{", "$", "managedSites", "=", "Multisites", "::", "inst", "(", ")", "->", "sitesManagedByMember", "(", ")", ";", "...
If the current member is not a "Manager" of any sites, they shouldn't be able to manage MultisitesAware DataObjects.
[ "If", "the", "current", "member", "is", "not", "a", "Manager", "of", "any", "sites", "they", "shouldn", "t", "be", "able", "to", "manage", "MultisitesAware", "DataObjects", "." ]
9b3fa1d3375ce073c050bd137b68766073efd458
https://github.com/symbiote/silverstripe-multisites/blob/9b3fa1d3375ce073c050bd137b68766073efd458/src/Admin/MultisitesModelAdminExtension.php#L101-L112
train
symbiote/silverstripe-multisites
src/Admin/MultisitesModelAdminExtension.php
MultisitesModelAdminExtension.updateSearchForm
public function updateSearchForm($form){ if($this->modelIsMultiSitesAware()) { $managedSites = Multisites::inst()->sitesManagedByMember(); $source = Site::get()->filter('ID', Multisites::inst()->sitesManagedByMember())->map('ID', 'Title')->toArray(); $plural = singleton($this->owner->modelClass)->plural_name(); if(count($source)){ $activeSite = $this->getActiveSite(); $form->Fields()->push(DropdownField::create( 'SiteID', "Site: ", $source, $activeSite ? $activeSite->ID : null )); } } }
php
public function updateSearchForm($form){ if($this->modelIsMultiSitesAware()) { $managedSites = Multisites::inst()->sitesManagedByMember(); $source = Site::get()->filter('ID', Multisites::inst()->sitesManagedByMember())->map('ID', 'Title')->toArray(); $plural = singleton($this->owner->modelClass)->plural_name(); if(count($source)){ $activeSite = $this->getActiveSite(); $form->Fields()->push(DropdownField::create( 'SiteID', "Site: ", $source, $activeSite ? $activeSite->ID : null )); } } }
[ "public", "function", "updateSearchForm", "(", "$", "form", ")", "{", "if", "(", "$", "this", "->", "modelIsMultiSitesAware", "(", ")", ")", "{", "$", "managedSites", "=", "Multisites", "::", "inst", "(", ")", "->", "sitesManagedByMember", "(", ")", ";", ...
Provide a Site filter
[ "Provide", "a", "Site", "filter" ]
9b3fa1d3375ce073c050bd137b68766073efd458
https://github.com/symbiote/silverstripe-multisites/blob/9b3fa1d3375ce073c050bd137b68766073efd458/src/Admin/MultisitesModelAdminExtension.php#L117-L133
train
symbiote/silverstripe-multisites
src/Admin/MultisitesModelAdminExtension.php
MultisitesModelAdminExtension.getActiveSite
public function getActiveSite() { if($this->owner->config()->use_active_site_session) { return Multisites::inst()->getActiveSite(); } else { if($this->modelIsMultiSitesAware()) { if($active = $this->owner->getRequest()->getSession()->get($this->getActiveSiteSessionKey())) { return Site::get()->byID($active); } } } }
php
public function getActiveSite() { if($this->owner->config()->use_active_site_session) { return Multisites::inst()->getActiveSite(); } else { if($this->modelIsMultiSitesAware()) { if($active = $this->owner->getRequest()->getSession()->get($this->getActiveSiteSessionKey())) { return Site::get()->byID($active); } } } }
[ "public", "function", "getActiveSite", "(", ")", "{", "if", "(", "$", "this", "->", "owner", "->", "config", "(", ")", "->", "use_active_site_session", ")", "{", "return", "Multisites", "::", "inst", "(", ")", "->", "getActiveSite", "(", ")", ";", "}", ...
get the active site for this model admin @return Site
[ "get", "the", "active", "site", "for", "this", "model", "admin" ]
9b3fa1d3375ce073c050bd137b68766073efd458
https://github.com/symbiote/silverstripe-multisites/blob/9b3fa1d3375ce073c050bd137b68766073efd458/src/Admin/MultisitesModelAdminExtension.php#L140-L150
train
symbiote/silverstripe-multisites
src/Admin/MultisitesModelAdminExtension.php
MultisitesModelAdminExtension.setActiveSite
public function setActiveSite($siteID) { if($this->owner->config()->use_active_site_session) { Multisites::inst()->setActiveSite($siteID); } else { $this->owner->getRequest()->getSession()->set($this->getActiveSiteSessionKey(), $siteID); } }
php
public function setActiveSite($siteID) { if($this->owner->config()->use_active_site_session) { Multisites::inst()->setActiveSite($siteID); } else { $this->owner->getRequest()->getSession()->set($this->getActiveSiteSessionKey(), $siteID); } }
[ "public", "function", "setActiveSite", "(", "$", "siteID", ")", "{", "if", "(", "$", "this", "->", "owner", "->", "config", "(", ")", "->", "use_active_site_session", ")", "{", "Multisites", "::", "inst", "(", ")", "->", "setActiveSite", "(", "$", "siteI...
Set the active site for this model admin @param int $siteID @return void
[ "Set", "the", "active", "site", "for", "this", "model", "admin" ]
9b3fa1d3375ce073c050bd137b68766073efd458
https://github.com/symbiote/silverstripe-multisites/blob/9b3fa1d3375ce073c050bd137b68766073efd458/src/Admin/MultisitesModelAdminExtension.php#L158-L164
train