/** * Deletes a language and redirect to admin/multilanguage/languages/manage * * Route: admin/multilanguage/languages/delete/:num * * @param int $id The id of the language to delete. */ public static function delete($id) { if (Multilanguage::language()->delete($id)) { Message::ok('Language deleted successfully.'); } else { Message::error('Error deleting language, please try again.'); } Url::redirect('admin/multilanguage/languages/manage'); }
function main() { $rs .= $this->get_app_title_bar(); $rs .= Multilanguage::_('APPLICATION_NAME', 'begateway') . ' '; if ($this->getConfigValue('apps.begateway.enable')) { $rs .= Multilanguage::_('APP_ON', 'begateway'); } else { $rs .= Multilanguage::_('APP_OFF', 'begateway'); } return $rs; }
/** * Returns the current relative url without trailing slashes. Does NOT include base url. * The current url will always start with a slash "/". */ public static function current() { if (is_null(self::$_current)) { if (isset($_GET['r']) && strlen($_GET['r'])) { self::$_current = $_GET['r']; } if (Multilanguage::urlHasLangCode(self::$_current)) { self::$_current = substr(self::$_current, 3); } if (!strlen(self::$_current)) { self::$_current = '/'; } else { self::$_current = '/' . trim(self::$_current, '/'); } } return self::$_current; }
/** * Deletes an actual stored string and redirects back to manage strings page. This will * also delete any translations associated with it. */ public static function delete($stringId) { Multilanguage::string()->where('stringcontent_id', '=', $stringId)->delete(); if (Multilanguage::stringcontent()->delete($stringId)) { Message::ok('String deleted successfully.'); } else { Message::error('Error deleting string, please try again.'); } Url::redirect('admin/multilanguage/strings/manage'); }
/** * Callback for the multilanguage.content_type[module][type] event */ public static function _getContentType($data) { self::$_contentType = $data; }
/** * Builds the contents form based on parameters returned from event. * * @param array $data An array of data to populate the form fields with when editing, key is field name, value is field value */ private static function _buildForm($module, $type, $typeId, $typeInfo, $data = array()) { $langs = Multilanguage::language()->orderBy('name')->all(); $sortedLangs = array('' => 'Choose One'); foreach ($langs as $lang) { $sortedLangs[$lang->id] = $lang->name; } $form[] = array('fields' => array('language_id' => array('title' => 'Language', 'type' => 'select', 'options' => $sortedLangs, 'validate' => array('required'), 'selected' => isset($data['language_id']) ? $data['language_id'] : 0))); foreach ($typeInfo as $colName => $colType) { $form[0]['fields'][$colName] = array('title' => ucfirst($colName), 'type' => $colType, 'validate' => array('required'), 'default_value' => isset($data[$colName]) ? $data[$colName] : ''); // Add tinymce to textareas if ($colType == 'textarea') { $form[0]['fields'][$colName]['attributes'] = array('class' => 'tinymce'); } } // Determine if we are creating or editing if ($data) { $form[0]['fields']['update_content'] = array('type' => 'submit', 'value' => 'Update Content'); } else { $form[0]['fields']['create_content'] = array('type' => 'submit', 'value' => 'Create Content'); } return Html::form()->build($form); }
/** * Stores data to be injected into views. The data is stored as key, value pairs. * * The "key" represents the name of the variable in the view. The value is given * to the keys variable. * * An array of key value pairs can be passed instead of doing one at a time. * * @param string $key The name of the variable to create in the view * @param mixed $value The value associated with the variable $key */ public static function data($key, $value = null) { if (is_array($key)) { //self::$_data = array_merge(self::$_data, $key); foreach ($key as $k => $v) { self::data($k, $v); } } else { self::$_data[$key] = Multilanguage::getTranslation($value); } }
/** * Check bill info * @param int $bill_id bill id * @return boolean */ function checkBill($bill_id) { $status = 0; $DBC = DBC::getInstance(); $query = 'SELECT `status` FROM ' . DB_PREFIX . '_bill WHERE `bill_id`=? LIMIT 1'; $stmt = $DBC->query($query, array($bill_id)); if ($stmt) { $ar = $DBC->fetch($stmt); $status = $ar['status']; } if ($status != 0) { $this->RiseError(Multilanguage::_('ORDER_PAYED_NOW', 'system')); return false; } return true; }