本文整理汇总了PHP中class_carrier类的典型用法代码示例。如果您正苦于以下问题:PHP class_carrier类的具体用法?PHP class_carrier怎么用?PHP class_carrier使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了class_carrier类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test
public function test()
{
$objDB = class_carrier::getInstance()->getObjDB();
echo "\tmodul_guestbook...\n";
echo "creating a new guestbook, moderated...\n";
$objGuestbook = new class_module_guestbook_guestbook();
$objGuestbook->setStrGuestbookTitle("test guestbook");
$objGuestbook->setIntGuestbookModerated(1);
$objGuestbook->updateObjectToDb();
$strGBId = $objGuestbook->getSystemid();
echo "adding a new post...\n";
$objPost = new class_module_guestbook_post();
$objPost->setStrGuestbookPostName("subject");
$objPost->setStrGuestbookPostText("test");
$objPost->updateObjectToDb($strGBId);
$objDB->flushQueryCache();
$this->assertEquals(0, count(class_module_guestbook_post::getPosts($strGBId, true)), __FILE__ . " check nr of posts portal");
$this->assertEquals(1, count(class_module_guestbook_post::getPosts($strGBId)), __FILE__ . " check nr of posts total");
echo "setting guestbook non-moderated...\n";
$objGuestbook->setIntGuestbookModerated(0);
$objGuestbook->updateObjectToDb();
$objDB->flushQueryCache();
echo "adding a new post...\n";
$objPost = new class_module_guestbook_post();
$objPost->setStrGuestbookPostName("subject2");
$objPost->setStrGuestbookPostText("test2");
$objPost->updateObjectToDb($strGBId);
$this->assertEquals(1, count(class_module_guestbook_post::getPosts($strGBId, true)), __FILE__ . " check nr of posts portal");
$this->assertEquals(2, count(class_module_guestbook_post::getPosts($strGBId)), __FILE__ . " check nr of posts total");
$objDB->flushQueryCache();
echo "deleting the guestbook...\n";
$objGuestbook->deleteObjectFromDatabase();
}
示例2: actionGetReport
/**
* Triggers the "real" creation of the report and wraps the code inline into a xml-structure
*
* @return string
* @permissions view
*/
protected function actionGetReport()
{
$strPlugin = $this->getParam("plugin");
$strReturn = "";
$objPluginManager = new class_pluginmanager(class_module_stats_admin::$STR_PLUGIN_EXTENSION_POINT, "/admin/statsreports");
$objPlugin = null;
foreach ($objPluginManager->getPlugins(array(class_carrier::getInstance()->getObjDB(), $this->objToolkit, $this->getObjLang())) as $objOneReport) {
if (uniStrReplace("class_stats_report_", "", get_class($objOneReport)) == $strPlugin) {
$objPlugin = $objOneReport;
break;
}
}
if ($objPlugin !== null && $objPlugin instanceof interface_admin_statsreports) {
//get date-params as ints
$intStartDate = mktime(0, 0, 0, $this->objDateStart->getIntMonth(), $this->objDateStart->getIntDay(), $this->objDateStart->getIntYear());
$intEndDate = mktime(0, 0, 0, $this->objDateEnd->getIntMonth(), $this->objDateEnd->getIntDay(), $this->objDateEnd->getIntYear());
$objPlugin->setEndDate($intEndDate);
$objPlugin->setStartDate($intStartDate);
$objPlugin->setInterval($this->intInterval);
$arrImage = $objPlugin->getReportGraph();
if (!is_array($arrImage)) {
$arrImage = array($arrImage);
}
foreach ($arrImage as $strImage) {
if ($strImage != "") {
$strReturn .= $this->objToolkit->getGraphContainer($strImage);
}
}
$strReturn .= $objPlugin->getReport();
$strReturn = "<content><![CDATA[" . $strReturn . "]]></content>";
}
return $strReturn;
}
示例3: execute
public function execute()
{
$objDB = class_carrier::getInstance()->getObjDB();
$objDB->dumpDb();
//trigger again
return false;
}
示例4: updateValue
/**
* Overwritten in order to load key-value pairs declared by annotations
*/
protected function updateValue()
{
parent::updateValue();
if ($this->getObjSourceObject() != null && $this->getStrSourceProperty() != "") {
$objReflection = new class_reflection($this->getObjSourceObject());
//try to find the matching source property
$arrProperties = $objReflection->getPropertiesWithAnnotation(self::STR_DDVALUES_ANNOTATION);
$strSourceProperty = null;
foreach ($arrProperties as $strPropertyName => $strValue) {
if (uniSubstr(uniStrtolower($strPropertyName), uniStrlen($this->getStrSourceProperty()) * -1) == $this->getStrSourceProperty()) {
$strSourceProperty = $strPropertyName;
}
}
if ($strSourceProperty == null) {
return;
}
$strDDValues = $objReflection->getAnnotationValueForProperty($strSourceProperty, self::STR_DDVALUES_ANNOTATION);
if ($strDDValues !== null && $strDDValues != "") {
$arrDDValues = array();
foreach (explode(",", $strDDValues) as $strOneKeyVal) {
$strOneKeyVal = uniSubstr(trim($strOneKeyVal), 1, -1);
$arrOneKeyValue = explode("=>", $strOneKeyVal);
$strKey = trim($arrOneKeyValue[0]) == "" ? " " : trim($arrOneKeyValue[0]);
if (count($arrOneKeyValue) == 2) {
$strValue = class_carrier::getInstance()->getObjLang()->getLang(trim($arrOneKeyValue[1]), $this->getObjSourceObject()->getArrModule("modul"));
if ($strValue == "!" . trim($arrOneKeyValue[1]) . "!") {
$strValue = $arrOneKeyValue[1];
}
$arrDDValues[$strKey] = $strValue;
}
}
$this->setArrKeyValues($arrDDValues);
}
}
}
示例5: handleEvent
/**
* Searches for tags assigned to the systemid to be deleted.
*
* @param string $strEventName
* @param array $arrArguments
*
* @return bool
*/
public function handleEvent($strEventName, array $arrArguments)
{
//unwrap arguments
list($strSystemid, $strSourceClass) = $arrArguments;
$bitReturn = true;
if ($strSourceClass == "class_module_tags_tag" && class_module_system_module::getModuleByName("tags") != null) {
//delete matching favorites
class_orm_base::setObjHandleLogicalDeletedGlobal(class_orm_deletedhandling_enum::INCLUDED());
$arrFavorites = class_module_tags_favorite::getAllFavoritesForTag($strSystemid);
foreach ($arrFavorites as $objOneFavorite) {
if ($strEventName == class_system_eventidentifier::EVENT_SYSTEM_RECORDDELETED_LOGICALLY) {
$bitReturn = $bitReturn && $objOneFavorite->deleteObject();
}
if ($strEventName == class_system_eventidentifier::EVENT_SYSTEM_RECORDDELETED) {
$bitReturn = $bitReturn && $objOneFavorite->deleteObjectFromDatabase();
$bitReturn = $bitReturn && class_carrier::getInstance()->getObjDB()->_pQuery("DELETE FROM " . _dbprefix_ . "tags_member WHERE tags_tagid=?", array($strSystemid));
}
}
class_orm_base::setObjHandleLogicalDeletedGlobal(class_orm_deletedhandling_enum::EXCLUDED());
}
//delete memberships. Fire a plain query, faster then searching.
if ($strEventName == class_system_eventidentifier::EVENT_SYSTEM_RECORDDELETED) {
$bitReturn = $bitReturn && class_carrier::getInstance()->getObjDB()->_pQuery("DELETE FROM " . _dbprefix_ . "tags_member WHERE tags_systemid=?", array($strSystemid));
}
return $bitReturn;
}
示例6: debugHelper
public function debugHelper()
{
echo "<pre>";
echo "<b>Kajona V4 Debug Subsystem</b>\n\n";
if (getGet("debugfile") != "") {
echo "Loading path for " . getGet("debugfile") . "\n";
$strPath = array_search(getGet("debugfile"), class_resourceloader::getInstance()->getFolderContent("/debug", array(".php")));
if ($strPath !== false) {
echo "Passing request to " . $strPath . "\n\n";
include _realpath_ . $strPath;
}
} else {
echo "Searching for debug-scripts available...\n";
$arrFiles = class_resourceloader::getInstance()->getFolderContent("/debug", array(".php"));
echo "<ul>";
foreach ($arrFiles as $strPath => $strOneFile) {
echo "<li><a href='?debugfile=" . $strOneFile . "' >" . $strOneFile . "</a> <br />" . $strPath . "</li>";
}
echo "</ul>";
}
$arrTimestampEnde = gettimeofday();
$intTimeUsed = ($arrTimestampEnde['sec'] * 1000000 + $arrTimestampEnde['usec'] - ($this->arrTimestampStart['sec'] * 1000000 + $this->arrTimestampStart['usec'])) / 1000000;
echo "\n\n<b>PHP-Time:</b> " . number_format($intTimeUsed, 6) . " sec \n";
echo "<b>Queries db/cachesize/cached/fired:</b> " . class_carrier::getInstance()->getObjDB()->getNumber() . "/" . class_carrier::getInstance()->getObjDB()->getCacheSize() . "/" . class_carrier::getInstance()->getObjDB()->getNumberCache() . "/" . (class_carrier::getInstance()->getObjDB()->getNumber() - class_carrier::getInstance()->getObjDB()->getNumberCache()) . "\n";
echo "<b>Templates cached:</b> " . class_carrier::getInstance()->getObjTemplate()->getNumberCacheSize() . " \n";
echo "<b>Memory/Max Memory:</b> " . bytesToString(memory_get_usage()) . "/" . bytesToString(memory_get_peak_usage()) . " \n";
echo "<b>Classes Loaded:</b> " . class_classloader::getInstance()->getIntNumberOfClassesLoaded() . " \n";
echo "<b>Cache requests/hits/saves/cachesize:</b> " . class_cache::getIntRequests() . "/" . class_cache::getIntHits() . "/" . class_cache::getIntSaves() . "/" . class_cache::getIntCachesize() . " \n";
echo "</pre>";
}
示例7: install
public function install()
{
$strReturn = "";
$strReturn .= "Installing table packageserver_log...\n";
$arrFields = array();
$arrFields["log_id"] = array("char20", false);
$arrFields["log_query"] = array("text", true);
$arrFields["log_ip"] = array("char254", true);
$arrFields["log_hostname"] = array("char254", true);
$arrFields["log_date"] = array("long", true);
if (!$this->objDB->createTable("packageserver_log", $arrFields, array("log_id"), array("log_date"), false)) {
$strReturn .= "An error occurred! ...\n";
}
//register the module
$this->registerModule("packageserver", _packageserver_module_id_, "class_module_packageserver_portal.php", "class_module_packageserver_admin.php", $this->objMetadata->getStrVersion(), true);
$strReturn .= "creating package-upload-repository...\n";
$objFilesytem = new class_filesystem();
$objFilesytem->folderCreate("/files/packages");
$objRepo = new class_module_mediamanager_repo();
$objRepo->setStrPath("/files/packages");
$objRepo->setStrViewFilter(".zip");
$objRepo->setStrUploadFilter(".zip");
$objRepo->setStrTitle("Packageserver packages");
$objRepo->updateObjectToDb();
class_carrier::getInstance()->getObjRights()->addGroupToRight(class_module_system_setting::getConfigValue("_guests_group_id_"), $objRepo->getSystemid(), class_rights::$STR_RIGHT_RIGHT2);
$strReturn .= "Registering system-constants...\n";
$this->registerConstant("_packageserver_repo_id_", "", class_module_system_setting::$int_TYPE_STRING, _packageserver_module_id_);
$strReturn .= "Setting aspect assignments...\n";
if (class_module_system_aspect::getAspectByName("content") != null) {
$objModule = class_module_system_module::getModuleByName($this->objMetadata->getStrTitle());
$objModule->setStrAspect(class_module_system_aspect::getAspectByName("content")->getSystemid());
$objModule->updateObjectToDb();
}
return $strReturn;
}
示例8: generateFieldsFromObject
/**
* @inheritDoc
*/
public function generateFieldsFromObject()
{
parent::generateFieldsFromObject();
$objNews = $this->getObjSourceobject();
if ($objNews->getSystemid() != class_module_system_module::getModuleByName("news")->getSystemid()) {
//search the languages maintained
$objLanguageManager = class_module_languages_languageset::getLanguagesetForSystemid($objNews->getSystemid());
if ($objLanguageManager != null) {
$arrMaintained = $objLanguageManager->getArrLanguageSet();
$arrDD = array();
foreach ($arrMaintained as $strLanguageId => $strSystemid) {
$objLanguage = new class_module_languages_language($strLanguageId);
$arrDD[$strSystemid] = $this->getLang("lang_" . $objLanguage->getStrName(), "languages");
}
class_module_languages_admin::enableLanguageSwitch();
class_module_languages_admin::setArrLanguageSwitchEntries($arrDD);
class_module_languages_admin::setStrOnChangeHandler("window.location='" . class_link::getLinkAdminHref("news", "editNews") . (class_module_system_setting::getConfigValue("_system_mod_rewrite_") == "true" ? "?" : "&") . "systemid='+this.value+'&pe=" . class_carrier::getInstance()->getParam("pe") . "';");
class_module_languages_admin::setStrActiveKey($objNews->getSystemid());
}
}
$arrCats = class_module_news_category::getObjectList();
if (count($arrCats) > 0) {
$arrKeyValues = array();
/** @var class_module_news_category $objOneCat */
foreach ($arrCats as $objOneCat) {
$arrKeyValues[$objOneCat->getSystemid()] = $objOneCat->getStrDisplayName();
}
$this->getField("cats")->setStrLabel($this->getLang("commons_categories"))->setArrKeyValues($arrKeyValues);
}
if (class_module_system_setting::getConfigValue("_news_news_datetime_") == "true") {
$this->addField(new class_formentry_datetime($this->getStrFormname(), "objDateStart", $objNews), "datestart")->setBitMandatory(true)->setStrLabel($this->getLang("form_news_datestart"));
$this->addField(new class_formentry_datetime($this->getStrFormname(), "objDateEnd", $objNews), "dateend")->setStrLabel($this->getLang("form_news_dateend"));
$this->addField(new class_formentry_datetime($this->getStrFormname(), "objDateSpecial", $objNews), "datespecial")->setStrLabel($this->getLang("form_news_datespecial"));
}
}
示例9: getWidgetOutput
/**
* This method is called, when the widget should generate it's content.
* Return the complete content using the methods provided by the base class.
* Do NOT use the toolkit right here!
*
* @return string
*/
public function getWidgetOutput()
{
if (!class_module_system_module::getModuleByName("system")->rightView() || !class_carrier::getInstance()->getObjSession()->isSuperAdmin()) {
return $this->getLang("commons_error_permissions");
}
$strReturn = "<style type=\"text/css\">\n .adminwidget_systemcheck .ok {\n color: green;\n }\n .adminwidget_systemcheck .nok {\n color: red;\n font-weight: bold;\n }\n </style>";
//check wich infos to produce
if ($this->getFieldValue("php") == "checked") {
$strReturn .= $this->widgetText($this->getLang("systemcheck_php_safemode") . (ini_get("safe_mode") ? $this->getLang("commons_yes") : $this->getLang("commons_no")));
$strReturn .= $this->widgetText($this->getLang("systemcheck_php_urlfopen") . (ini_get("allow_url_fopen") ? $this->getLang("commons_yes") : $this->getLang("commons_no")));
$strReturn .= $this->widgetText($this->getLang("systemcheck_php_regglobal") . (ini_get("register_globals") ? "<span class=\"nok\">" . $this->getLang("commons_yes") . "</span>" : "<span class=\"ok\">" . $this->getLang("commons_no") . "</span>"));
$strReturn .= $this->widgetSeparator();
}
if ($this->getFieldValue("kajona") == "checked") {
$arrFilesAvailable = array("/installer.php", "/debug.php", "/v3_v4_postupdate.php");
foreach ($arrFilesAvailable as $strOneFile) {
$strReturn .= $this->widgetText($strOneFile . " " . $this->getLang("systemcheck_kajona_filepresent") . (is_file(_realpath_ . $strOneFile) ? " <span class=\"nok\">" . $this->getLang("commons_yes") . "</span>" : " <span class=\"ok\">" . $this->getLang("commons_no") . "</span>"));
}
$strReturn .= $this->widgetText($this->getLang("systemcheck_kajona_writeper") . " /project/system/config/config.php " . (is_writable(_realpath_ . "/project/system/config/config.php") ? "<span class=\"nok\">" . $this->getLang("commons_yes") . "</span>" : "<span class=\"ok\">" . $this->getLang("commons_no") . "</span>"));
$strReturn .= $this->widgetText($this->getLang("systemcheck_kajona_writeper") . " /project/log/ " . (is_writable(_realpath_ . "/project/log/") ? "<span class=\"ok\">" . $this->getLang("commons_yes") . "</span>" : "<span class=\"nok\">" . $this->getLang("commons_no") . "</span>"));
$strReturn .= $this->widgetText($this->getLang("systemcheck_kajona_writeper") . " /project/dbdumps/ " . (is_writable(_realpath_ . "/project/dbdumps/") ? "<span class=\"ok\">" . $this->getLang("commons_yes") . "</span>" : "<span class=\"nok\">" . $this->getLang("commons_no") . "</span>"));
$strReturn .= $this->widgetText($this->getLang("systemcheck_kajona_writeper") . " /project/temp " . (is_writable(_realpath_ . "/project/temp") ? "<span class=\"ok\">" . $this->getLang("commons_yes") . "</span>" : "<span class=\"nok\">" . $this->getLang("commons_no") . "</span>"));
$strReturn .= $this->widgetText($this->getLang("systemcheck_kajona_writeper") . " " . _images_cachepath_ . " " . (is_writable(_realpath_ . "/" . _images_cachepath_) ? "<span class=\"ok\">" . $this->getLang("commons_yes") . "</span>" : "<span class=\"nok\">" . $this->getLang("commons_no") . "</span>"));
foreach (class_classloader::getCoreDirectories() as $strOneCore) {
$strReturn .= $this->widgetText($this->getLang("systemcheck_kajona_writeper") . " /" . $strOneCore . " " . (is_writable(_realpath_ . "/" . $strOneCore) ? "<span class=\"ok\">" . $this->getLang("commons_yes") . "</span>" : "<span class=\"nok\">" . $this->getLang("commons_no") . "</span>"));
}
}
return "<div class=\"adminwidget_systemcheck\">" . $strReturn . "</div>";
}
示例10: validateObject
/**
* Validates a news start/end/archive date for a correct logical order.
*
*
* @param class_model $objObject - the model object to the given form
* @return bool
*/
public function validateObject(class_model $objObject)
{
$objLang = class_carrier::getInstance()->getObjLang();
$strModuleName = $objObject->getArrModule("modul");
if ($objObject instanceof class_module_news_news) {
//validate: $objStartDate < $objSpecialDate < $objEndDate
$objStartDate = $objObject->getObjStartDate();
$objEndDate = $objObject->getObjEndDate();
$objSpecialDate = $objObject->getObjSpecialDate();
$strLabelStartDate = $objLang->getLang("form_" . $objObject->getArrModule("modul") . "_datestart", $strModuleName);
$strLabelEndDate = $objLang->getLang("form_" . $objObject->getArrModule("modul") . "_dateend", $strModuleName);
$strLabelSpecialDate = $objLang->getLang("form_" . $objObject->getArrModule("modul") . "_datespecial", $strModuleName);
if ($objStartDate != null && $objEndDate != null) {
if (class_objectvalidator_helper::compareDates($objStartDate, $objEndDate) === 1) {
$this->addValidationError("startdate", $objLang->getLang("commons_object_validator_datecompare_validationmessage_before", $strModuleName, array($strLabelStartDate, $strLabelEndDate)));
}
}
if ($objSpecialDate != null && $objEndDate != null) {
if (class_objectvalidator_helper::compareDates($objSpecialDate, $objEndDate) === 1) {
$this->addValidationError("startdate", $objLang->getLang("commons_object_validator_datecompare_validationmessage_before", $strModuleName, array($strLabelSpecialDate, $strLabelEndDate)));
}
}
if ($objStartDate != null && $objSpecialDate != null) {
if (class_objectvalidator_helper::compareDates($objStartDate, $objSpecialDate) === 1) {
$this->addValidationError("startdate", $objLang->getLang("commons_object_validator_datecompare_validationmessage_before", $strModuleName, array($strLabelStartDate, $strLabelSpecialDate)));
}
}
} else {
return false;
}
return count($this->getArrValidationMessages()) == 0;
}
示例11: install
public function install()
{
$strReturn = "";
$objManager = new class_orm_schemamanager();
$strReturn .= "Installing table votings_voting...\n";
$objManager->createTable("class_module_votings_voting");
$strReturn .= "Installing table votings_answer...\n";
$objManager->createTable("class_module_votings_answer");
//register the module
$strSystemID = $this->registerModule($this->objMetadata->getStrTitle(), _votings_module_id_, "class_module_votings_portal.php", "class_module_votings_admin.php", $this->objMetadata->getStrVersion(), true);
//modify default rights to allow guests to vote
$strReturn .= "Modifying modules' rights node...\n";
class_carrier::getInstance()->getObjRights()->addGroupToRight(class_module_system_setting::getConfigValue("_guests_group_id_"), $strSystemID, "right1");
$strReturn .= "Registering votings-element...\n";
if (class_module_pages_element::getElement("votings") == null) {
$objElement = new class_module_pages_element();
$objElement->setStrName("votings");
$objElement->setStrClassAdmin("class_element_votings_admin.php");
$objElement->setStrClassPortal("class_element_votings_portal.php");
$objElement->setIntCachetime(-1);
$objElement->setIntRepeat(1);
$objElement->setStrVersion($this->objMetadata->getStrVersion());
$objElement->updateObjectToDb();
$strReturn .= "Element registered...\n";
} else {
$strReturn .= "Element already installed!...\n";
}
$strReturn .= "Setting aspect assignments...\n";
if (class_module_system_aspect::getAspectByName("content") != null) {
$objModule = class_module_system_module::getModuleByName($this->objMetadata->getStrTitle());
$objModule->setStrAspect(class_module_system_aspect::getAspectByName("content")->getSystemid());
$objModule->updateObjectToDb();
}
return $strReturn;
}
示例12: __construct
/**
* Default constructor
*/
public function __construct()
{
// Try to overwrite PHP memory-limit so large images can be processed, too
if (class_carrier::getInstance()->getObjConfig()->getPhpIni("memory_limit") < 128) {
@ini_set("memory_limit", "128M");
}
}
示例13: generateLogEntry
/**
* Generates a new entry in the log-table
*
* @param string $strSeachterm
*
* @return bool
* @static
*/
public static function generateLogEntry($strSeachterm)
{
$objLanguage = new class_module_languages_language();
$strLanguage = $objLanguage->getStrPortalLanguage();
$strQuery = "INSERT INTO " . _dbprefix_ . "search_log \n (search_log_id, search_log_date, search_log_query, search_log_language) VALUES\n (?, ?, ?, ? )";
return class_carrier::getInstance()->getObjDB()->_pQuery($strQuery, array(generateSystemid(), (int) time(), $strSeachterm, $strLanguage));
}
示例14: checkSingleLevel
private function checkSingleLevel($strParentId, &$arrReturn)
{
$objRights = class_carrier::getInstance()->getObjRights();
$arrParentRights = $objRights->getArrayRights($strParentId);
//load the sub-ordinate nodes
$objCommon = new class_module_system_common();
$arrChildNodes = $objCommon->getChildNodesAsIdArray($strParentId);
foreach ($arrChildNodes as $strOneChildId) {
if (!$objRights->isInherited($strOneChildId)) {
$arrChildRights = $objRights->getArrayRights($strOneChildId);
$bitIsDifferent = false;
foreach ($arrChildRights as $strPermission => $arrOneChildPermission) {
if ($strPermission == class_rights::$STR_RIGHT_INHERIT) {
continue;
}
if (count(array_diff($arrChildRights[$strPermission], $arrParentRights[$strPermission])) != 0) {
$bitIsDifferent = true;
break;
}
}
if (!$bitIsDifferent) {
$arrReturn[] = class_objectfactory::getInstance()->getObject($strOneChildId);
$objRights->setInherited(true, $strOneChildId);
}
}
$this->checkSingleLevel($strOneChildId, $arrReturn);
}
}
示例15: handleEvent
/**
* Searches for languagesets containing the current systemid. either as a language or a referenced record.
* Called whenever a records was deleted using the common methods.
* Implement this method to be notified when a record is deleted, e.g. to to additional cleanups afterwards.
* There's no need to register the listener, this is done automatically.
* Make sure to return a matching boolean-value, otherwise the transaction may be rolled back.
*
* @param string $strEventName
* @param array $arrArguments
*
* @return bool
*/
public function handleEvent($strEventName, array $arrArguments)
{
//unwrap arguments
list($strSystemid, $strSourceClass) = $arrArguments;
if ($strSourceClass == "class_module_languages_language") {
//if we have just one language remaining, set this one as default
$arrObjLanguages = class_module_languages_language::getObjectList();
if (count($arrObjLanguages) == 1) {
$objOneLanguage = $arrObjLanguages[0];
$objOneLanguage->setBitDefault(1);
$objOneLanguage->updateObjectToDb();
}
//check if the current active one was deleted. if, then reset. #kajona trace id 613
$objLanguage = new class_module_languages_language();
$arrLangs = class_module_languages_language::getObjectList();
$arrFiltered = array_filter($arrLangs, function (class_module_languages_language $objSingleLang) use($objLanguage) {
return $objSingleLang->getStrName() == $objLanguage->getAdminLanguage();
});
if (count($arrFiltered) == 0 && count($arrLangs) > 0) {
$objLanguage->setStrAdminLanguageToWorkOn($arrLangs[0]->getStrName());
}
}
//fire a plain query on the database, much faster then searching for matching records
$strQuery = "DELETE FROM " . _dbprefix_ . "languages_languageset\n WHERE languageset_language = ?\n OR languageset_systemid = ?";
class_carrier::getInstance()->getObjDB()->_pQuery($strQuery, array($strSystemid, $strSystemid));
return true;
}