This repository has been archived by the owner on Mar 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0e3c906
commit 3a99de6
Showing
23 changed files
with
518 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# FUEL CMS Translatable Module | ||
|
||
The Translatable Module is a module for the FUEL CMS content management system that allows setting up translatable fields for existing models. | ||
|
||
## Attributions | ||
* The module is built for use with [FUEL CMS](https://github.com/daylightstudio/FUEL-CMS), a framework built by David McReynolds, licenced under [Apache 2](http://www.apache.org/licenses/LICENSE-2.0.html). | ||
* The module uses icons from several icon sets by [FamFamFam](http://www.famfamfam.com/): | ||
* [FamFamFam Silk Icon Set](http://www.famfamfam.com/lab/icons/silk/) (licenced under a [Creative Commons Attribution 2.5 licence](http://creativecommons.org/licenses/by/2.5/)) | ||
* [Flag Icons Set](http://www.famfamfam.com/lab/icons/flags/). | ||
|
||
## Licence | ||
The Translatable module for FUEL CMS is licenced under [Apache 2](http://www.apache.org/licenses/LICENSE-2.0). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.ico_translatable_item { background-image: url(../images/ico_translatable_item.png); } | ||
.ico_translatable_item_translation { | ||
background-image: url(../images/ico_translatable_item_translation.png); | ||
background-position-y: 4px; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// jqx.load('plugin', 'date'); | ||
|
||
TranslatableController = jqx.createController(fuel.controller.BaseFuelController, { | ||
|
||
init: function(initObj){ | ||
this._super(initObj); | ||
}, | ||
|
||
add_edit : function(){ | ||
var _this = this; | ||
// do this first so that the fillin is in the checksaved value | ||
//fuel.controller.BaseFuelController.prototype.add_edit.call(this, false); | ||
this._super(); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| FUEL NAVIGATION: An array of navigation items for the left menu | ||
|-------------------------------------------------------------------------- | ||
*/ | ||
$config['nav']['translatable'] = array( | ||
'translatable_item' => 'Items', | ||
'translatable_item_translation' => 'Item translations', | ||
); | ||
|
||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| ADDITIONAL SETTINGS: | ||
|-------------------------------------------------------------------------- | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php | ||
define('TRANSLATABLE_VERSION', '0.1'); | ||
define('TRANSLATABLE_FOLDER', 'translatable'); | ||
define('TRANSLATABLE_PATH', MODULES_PATH.TRANSLATABLE_FOLDER.'/'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
$config['modules']['translatable_item'] = array( | ||
'preview_path' => '', | ||
'model_location' => 'translatable_item', | ||
); | ||
|
||
$config['modules']['translatable_item_translation'] = array( | ||
'preview_path' => '', | ||
'model_location' => 'translatable_item_translation', | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php | ||
$route[FUEL_ROUTE.'translatable_item'] = FUEL_FOLDER.'/module'; | ||
$route[FUEL_ROUTE.'translatable_item/(.*)'] = FUEL_FOLDER.'/module/$1'; | ||
|
||
$route[FUEL_ROUTE.'translatable_item_translation'] = FUEL_FOLDER.'/module'; | ||
$route[FUEL_ROUTE.'translatable_item_translation/(.*)'] = FUEL_FOLDER.'/module/$1'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
require_once(FUEL_PATH.'/libraries/Fuel_base_controller.php'); | ||
|
||
class Translatable_module extends Fuel_base_controller { | ||
|
||
public $nav_selected = 'translatable'; | ||
|
||
function __construct() | ||
{ | ||
parent::__construct(); | ||
} | ||
|
||
function index() | ||
{ | ||
$vars['page_title'] = $this->fuel->admin->page_title(array(lang('module_translatable')), FALSE); | ||
$crumbs = array('tools' => lang('section_tools'), lang('module_translatable')); | ||
|
||
$this->fuel->admin->set_titlebar($crumbs, 'ico_translatable'); | ||
$this->fuel->admin->render('_admin/translatable', $vars, '', TRANSLATABLE_FOLDER); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
/** | ||
* FUEL CMS | ||
* http://www.getfuelcms.com | ||
* | ||
* An open source Content Management System based on the | ||
* Codeigniter framework (http://codeigniter.com) | ||
* | ||
* @package FUEL CMS | ||
* @author David McReynolds @ Daylight Studio | ||
* @copyright Copyright (c) 2017, Daylight Studio LLC. | ||
* @license http://docs.getfuelcms.com/general/license | ||
* @link http://www.getfuelcms.com | ||
*/ | ||
|
||
// ------------------------------------------------------------------------ | ||
|
||
/** | ||
* Translatable Helper | ||
* | ||
* Contains functions for the Translatable module | ||
* | ||
* @package User Guide | ||
* @subpackage Helpers | ||
* @category Helpers | ||
*/ | ||
|
||
// -------------------------------------------------------------------- | ||
|
||
|
||
// put your helper functions here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; | ||
/*!40101 SET NAMES utf8 */; | ||
/*!50503 SET NAMES utf8mb4 */; | ||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; | ||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; | ||
|
||
CREATE TABLE IF NOT EXISTS `translatable_item` ( | ||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT, | ||
`title` varchar(255) COLLATE utf8_unicode_ci NOT NULL, | ||
`date_added` datetime DEFAULT NULL, | ||
`last_modified` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | ||
PRIMARY KEY (`id`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; | ||
|
||
CREATE TABLE IF NOT EXISTS `translatable_item_translation` ( | ||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT, | ||
`translatable_item_id` int(10) unsigned NOT NULL, | ||
`text` longtext COLLATE utf8_unicode_ci NOT NULL, | ||
`language` varchar(50) COLLATE utf8_unicode_ci NOT NULL, | ||
PRIMARY KEY (`id`), | ||
UNIQUE KEY `translatable_item_id_language` (`translatable_item_id`,`language`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; | ||
|
||
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; | ||
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */; | ||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
INSERT INTO `fuel_permissions` (`description`, `name`, `active`) | ||
VALUES | ||
('Translatable items', 'translatable_item', 'yes'), | ||
('Translatable items: Create', 'translatable_item/create', 'yes'), | ||
('Translatable items: Delete', 'translatable_item/delete', 'yes'), | ||
('Translatable items: Edit', 'translatable_item/edit', 'yes'), | ||
('Translatable item translations', 'translatable_item_translation', 'yes'), | ||
('Translatable item translations: Create', 'translatable_item_translation/create', 'yes'), | ||
('Translatable item translations: Delete', 'translatable_item_translation/delete', 'yes'), | ||
('Translatable item translations: Edit', 'translatable_item_translation/edit', 'yes'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
DROP TABLE `translatable_item`; | ||
DROP TABLE `translatable_item_translation`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
$config['name'] = 'Translatable Module'; | ||
$config['version'] = TRANSLATABLE_VERSION; | ||
$config['author'] = 'Martynas Šateika'; | ||
$config['company'] = ''; | ||
$config['license'] = 'Apache 2'; | ||
$config['copyright'] = '2017'; | ||
$config['author_url'] = 'https://www.martynassateika.lt'; | ||
$config['description'] = 'The Translatable module allows setting up translatable fields in your models.'; | ||
$config['compatibility'] = '1.0'; | ||
$config['instructions'] = ''; | ||
$config['permissions'] = 'translatable'; | ||
$config['migration_version'] = 0; | ||
$config['install_sql'] = 'fuel_translatable_install.sql'; | ||
$config['uninstall_sql'] = 'fuel_translatable_uninstall.sql'; | ||
$config['repo'] = ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
$lang['module_translatable'] = 'Translatable'; | ||
|
||
/** | ||
* Translatable item model | ||
*/ | ||
$lang['translation_item_model_notification_save_before_adding_translations'] = 'Save the item before adding translations.'; | ||
$lang['translation_item_model_translations'] = 'Translations'; | ||
$lang['translation_item_model_add_translation'] = 'Add translation'; | ||
|
||
/** | ||
* Translatable item translation model | ||
*/ | ||
$lang['translatable_item_translation_model_exists_for_language'] = 'There already exists a translation for this language.'; | ||
$lang['translatable_item_translation_model_create_via_translatable'] = 'Translations can only be added by editing translatable items.'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); | ||
/** | ||
* FUEL CMS | ||
* http://www.getfuelcms.com | ||
* | ||
* An open source Content Management System based on the | ||
* Codeigniter framework (http://codeigniter.com) | ||
*/ | ||
|
||
// ------------------------------------------------------------------------ | ||
|
||
/** | ||
* Fuel Translatable object | ||
* | ||
* @package FUEL CMS | ||
* @subpackage Libraries | ||
* @category Libraries | ||
*/ | ||
|
||
// ------------------------------------------------------------------------ | ||
|
||
class Fuel_translatable extends Fuel_advanced_module { | ||
|
||
public $name = "translatable"; // the folder name of the module | ||
|
||
/** | ||
* Constructor - Sets preferences | ||
* | ||
* The constructor can be passed an array of config values | ||
*/ | ||
public function __construct($params = array()) | ||
{ | ||
parent::__construct(); | ||
$this->initialize($params); | ||
} | ||
|
||
// -------------------------------------------------------------------- | ||
|
||
/** | ||
* Initialize the backup object | ||
* | ||
* Accepts an associative array as input, containing preferences. | ||
* Also will set the values in the config as properties of this object | ||
* | ||
* @access public | ||
* @param array config preferences | ||
* @return void | ||
*/ | ||
public function initialize($params = array()) | ||
{ | ||
parent::initialize($params); | ||
$this->set_params($this->_config); | ||
} | ||
|
||
// -------------------------------------------------------------------- | ||
|
||
/** | ||
* Add your custom methods for this advanced module below. | ||
* You will be able to access it via $this->fuel->translatable->my_method() | ||
*/ | ||
} |
Oops, something went wrong.