Permalink
Browse files

Translation and code style work.

  • Loading branch information...
1 parent dd8f152 commit 36786fe6d1aff03d5ef69d25d946c12e9d901cff @realityking committed Mar 25, 2011
View
@@ -0,0 +1 @@
+.DS_Store
View
Binary file not shown.
@@ -103,7 +103,7 @@ function remove()
//Load model and delete entry - redirect afterwards
$model = $this->getModel( 'entry' );
if (!$model->delete()) {
- $msg = JText::_('COM_HELPDESK_ERROR_ENTRY_NOT_DELETED');
+ $msg = JText::_('COM_HELPDESK_ERROR_ENTRY_DELETED');
$type = 'error';
} else {
$msg = JText::_('COM_HELPDESK_ENTRY_DELETED');
@@ -120,7 +120,7 @@ function publish()
$msg = JText::_('COM_HELPDESK_ENTRY_PUBLISHED');
$type = 'message';
} else {
- $msg = JText::_('COM_HELPDESK_ERROR_ENTRY_NOT_PUBLISHED')." - " .$model->getError();
+ $msg = JText::_('COM_HELPDESK_ERROR_ENTRY_CHANGE_PUBLISH_STATUS')." - " .$model->getError();
$type = 'error';
}
$this->setRedirect( JRoute::_('index.php?option=com_helpdesk', false), $msg, $type );
@@ -130,7 +130,7 @@ function unpublish()
{
JRequest::checkToken() or jexit( 'Invalid Token' );
$model = $this->getModel('entry');
- if($model->publish(0)) {
+ if ($model->publish(0)) {
$msg = JText::_('COM_HELPDESK_ENTRY_UNPUBLISHED');
$type = 'message';
} else {
View
Binary file not shown.
View
Binary file not shown.
@@ -27,14 +27,14 @@ COM_HELPDESK_MANAGER_ENTRY="Entry"
COM_HELPDESK_DECLINE_MAIL_SENT="Decline mail was sent"
COM_HELPDESK_ERROR_SAVING_ENTRY="Error saving entry"
-COM_HELPDESK_ENTRY_DELETED="Entry Deleted"
+COM_HELPDESK_ENTRY_DELETED="Entry deleted"
COM_HELPDESK_ENTRY_PUBLISHED="Entry published"
COM_HELPDESK_ENTRY_UNPUBLISHED="Entry unpublished"
-COM_HELPDESK_ERROR_ENTRY_NOT_DELETED="Error: Entry could not be deleted"
+COM_HELPDESK_ERROR_ENTRY_DELETED="Error: Entry could not be deleted"
COM_HELPDESK_ERROR_ENTRY_CHANGE_PUBLISH_STATUS="Error: Could not change publish status"
COM_HELPDESK_ENTRY_DECLINED_MAIL_SUBJECT="Helpdesk entry was declined"
-COM_HELPDESK_ENTRY_DECLINED_MAIL_BODY="Yours helpdeskentry was declined"
+COM_HELPDESK_ENTRY_DECLINED_MAIL_BODY="Your helpdeskentry was declined"
COM_HELPDESK_CONFIGURATION="Helpdesk Configuration"
COM_HELPDESK_CONFIG_GENERAL_SETTINGS_LABEL="General"
View
Binary file not shown.
View
@@ -34,11 +34,11 @@ function __construct()
/**
* Method to set the entry identifier
*
- * @access public
* @param int Entry identifier
+ *
* @return void
*/
- function setId($id)
+ public function setId($id)
{
// Set id and wipe data
$this->_id = $id;
@@ -47,6 +47,7 @@ function setId($id)
/**
* Method to get a entry
+ *
* @return object with data
*/
function getData()
@@ -69,10 +70,9 @@ function getData()
/**
* Method to store a record
*
- * @access public
* @return boolean True on success
*/
- function store()
+ public function store()
{
$row =& $this->getTable();
$data = JRequest::get('post');
@@ -98,7 +98,7 @@ function store()
return true;
}
- function delete()
+ public function delete()
{
$cids = JRequest::getVar( 'cid', array(0), 'post', 'array' );
$row =& $this->getTable();
@@ -114,7 +114,7 @@ function delete()
}
// Publishes an entry or unpublishes it
- function publish($state)
+ public function publish($state)
{
$cids = JRequest::getVar( 'cid', array(0), 'post', 'array' );
$row =& $this->getTable();
@@ -21,7 +21,7 @@
description="COM_HELPDESK_EMAIL_DESC" size="30"
required="true" />
- <field name="published" type="list" label="JGLOBAL_STATE"
+ <field name="published" type="list" label="JSTATUS"
description="JFIELD_PUBLISHED_DESC"
filter="intval" size="1" default="0">
<option value="1">JPUBLISHED</option>
View
@@ -49,7 +49,7 @@ function __construct()
* Returns the query
* @return string The query to be used to retrieve the rows from the database
*/
- function _buildQuery()
+ private function _buildQuery()
{
$query = "SELECT * FROM #__helpdesk"
. " ORDER BY hdate DESC";
@@ -59,9 +59,10 @@ function _buildQuery()
/**
* Retrieves the helpdesk entrys
+ *
* @return array Array of objects containing the data from the database
*/
- function getData()
+ public function getData()
{
// Lets load the data if it doesn't already exist
if (empty( $this->_data )) {
@@ -72,7 +73,7 @@ function getData()
return $this->_data;
}
- function getPagination()
+ public function getPagination()
{
if (empty($this->_pagination)) {
jimport('joomla.html.pagination');
@@ -83,9 +84,10 @@ function getPagination()
}
/**
* Retrieves the count of helpdesk entrys
+ *
* @return array Array of objects containing the data from the database
*/
- function getTotal()
+ public function getTotal()
{
if (empty($this->_total)) {
$query = $this->_buildQuery();
View
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
@@ -92,15 +92,15 @@ function save()
$upload_maxsize = $params->get('file_size', '10000000');
if ((!$id && $canAdd) || ($id && $canEdit)) {
- $model = $this->getModel( 'entry' );
+ $model = $this->getModel('entry');
if ($model->store()) {
//Set redirection options
if ($params->get('default_published', true)) {
- $msg .= JText::_( 'Entry Saved' );
+ $msg .= JText::_('COM_HELPDESK_ENTRY_SAVED');
$type = 'message';
} else {
- $msg .= JText::_( 'Entry saved but has to be approved');
+ $msg .= JText::_('COM_HELPDESK_ENTRY_NEEDS_APPROVAL');
$type = 'notice';
}
$link = JRoute::_( 'index.php?option=com_helpdesk&view=helpdesk', false );
@@ -125,7 +125,8 @@ function save()
$upload_base = str_replace(" ", "_", $base[0]);
$new_filename = $upload_location . $filename;
- while (file_exists($new_filename)) {
+ while (file_exists($new_filename))
+ {
$upload_base = $upload_base . "_" . $unique_suffix++;
$new_filename = $upload_location . $upload_base . $ext;
}
@@ -152,7 +153,7 @@ function save()
$db->query();
}
} else {
- $msg .= "<br />" . JText::sprintf('Error with upload', $ext) . "<br />" . JText::_('Allowed types') . ": " . $upload_filetypes . "<br />" . JText::_('File max size') . " (kb): " . ($upload_maxsize / 1024)."<br />";
+ $msg .= "<br />" . JText::sprintf('COM_HELPDESK_ERROR_UPLOAD', $ext) . "<br />" . JText::_('Allowed types') . ": " . $upload_filetypes . "<br />" . JText::_('File max size') . " (kb): " . ($upload_maxsize / 1024)."<br />";
$link = JRoute::_( 'index.php?option=com_helpdesk&controller=entry&task=add&retry=true', false );
$type = 'notice';
$ferror = true;
@@ -161,9 +162,9 @@ function save()
//Send information-mail to administrators
if ( (!$id AND $params->get('send_mail', true)) && (!$ferror) ) {
- $mail->setSubject( JTEXT::_( 'New Helpdesk entry' ) );
- $mail->setBody( JTEXT::sprintf( 'A new helpdeskentry has been written', $uri->base(), $name, $text ) );
- $mail->addBCC( $admins );
+ $mail->setSubject(JTEXT::_('COM_HELPDESK_ENTRY_NEW_MAIL_SUBJECT'));
+ $mail->setBody(JTEXT::sprintf('COM_HELPDESK_ENTRY_NEW_MAIL_BODY', $uri->base(), $name, $text));
+ $mail->addBCC($admins);
$mail->Send();
}
} else {
@@ -181,17 +182,17 @@ function save()
if (($filetypeok > 0) && ($filesize < $upload_maxsize)){
} else {
- $msg .= JText::sprintf('Error with upload', $ext) . "<br />" . JText::_('Allowed types') . ": " . $upload_filetypes . "<br />" . JText::_('File max size') . " (kb): " . ($upload_maxsize / 1024)."<br />";
+ $msg .= JText::sprintf('COM_HELPDESK_ERROR_UPLOAD', $ext) . "<br />" . JText::_('Allowed types') . ": " . $upload_filetypes . "<br />" . JText::_('File max size') . " (kb): " . ($upload_maxsize / 1024)."<br />";
}
}
- $msg .= JText::_( 'Error: Please validate your inputs' );
- $link = JRoute::_( 'index.php?option=com_helpdesk&controller=entry&task=add&retry=true', false );
+ $msg .= JText::_('COM_HELPDESK_ERROR_VALIDATE_INPUTS');
+ $link = JRoute::_('index.php?option=com_helpdesk&controller=entry&task=add&retry=true', false );
$type = 'notice';
}
- $this->setRedirect( $link, $msg, $type );
+ $this->setRedirect($link, $msg, $type);
} else {
- JError::raiseError( 403, JText::_( 'ALERTNOTAUTH' ) );
+ JError::raiseError(403, JText::_('ALERTNOTAUTH'));
}
}
@@ -215,44 +216,45 @@ function comment()
function remove()
{
//Load model and delete entry - redirect afterwards
- $model = $this->getModel( 'entry' );
+ $model = $this->getModel('entry');
if(!$model->delete()) {
- $msg = JText::_( 'Error: Entry could not be deleted' );
+ $msg = JText::_('COM_HELPDESK_ERROR_ENTRY_DELETED');
$type = 'error';
} else {
- $msg = JText::_( 'Entry Deleted' );
+ $msg = JText::_('COM_HELPDESK_ENTRY_DELETED');
$type = 'message';
}
$this->setRedirect( JRoute::_( 'index.php?option=com_helpdesk', false ), $msg, $type );
}
function publish() {
- $model = $this->getModel( 'entry' );
+ $model = $this->getModel('entry' ;
switch($model->publish()) {
- case -1: $msg = JText::_( 'Error: Could not change publish status' );
+ case -1: $msg = JText::_('COM_HELPDESK_ERROR_ENTRY_CHANGE_PUBLISH_STATUS');
$type = 'error';
break;
- case 0: $msg = JText::_( 'Entry unpublished' );
+ case 0: $msg = JText::_('COM_HELPDESK_ENTRY_UNPUBLISHED');
$type = 'message';
break;
- case 1: $msg = JText::_( 'Entry published' );
+ case 1: $msg = JText::_('COM_HELPDESK_ENTRY_PUBLISHED');
$type = 'message';
break;
}
- $this->setRedirect( JRoute::_( 'index.php?option=com_helpdesk', false ), $msg, $type );
+ $this->setRedirect( JRoute::_('index.php?option=com_helpdesk', false), $msg, $type );
}
/**
* save a comment
- * @return void
- */
- function savecomment() {
- $model = $this->getModel( 'entry' );
+ * @return void
+ */
+ function savecomment()
+ {
+ $model = $this->getModel('entry');
if(!$model->savecomment()) {
- $msg = JText::_( 'Error: Could not save comment' );
+ $msg = JText::_('COM_HELPDESK_COMMENT_ERROR_NOT_SAVED');
$type = 'error';
} else {
- $msg = JText::_( 'Comment saved' );
+ $msg = JText::_('COM_HELPDESK_COMMENT_SAVED');
$type = 'message';
}
$this->setRedirect( JRoute::_( 'index.php?option=com_helpdesk', false ), $msg, $type );
@@ -10,7 +10,8 @@ class HelpdeskHelper {
/**
* Get the actions
*/
- public static function getActions() {
+ public static function getActions()
+ {
$user = JFactory::getUser();
$result = new JObject;
View
Binary file not shown.
@@ -6,4 +6,20 @@ COM_HELPDESK_DECLINED="Declined"
COM_HELPDESK_FINISHED="Finished"
COM_HELPDESK_IN_PROGRESS="Under progress"
COM_HELPDESK_NOT_IN_PROGRESS="Not in progress"
-COM_HELPDESK_ADMIN_COMMENT="Admin comment"
+COM_HELPDESK_ADMIN_COMMENT="Admin comment"
+
+COM_HELPDESK_ENTRY_NEEDS_APPROVAL="Entry saved but has to be approved"
+COM_HELPDESK_ENTRY_SAVED="Entry saved"
+COM_HELPDESK_ENTRY_DELETED="Entry deleted"
+COM_HELPDESK_ENTRY_PUBLISHED="Entry published"
+COM_HELPDESK_ENTRY_UNPUBLISHED="Entry unpublished"
+COM_HELPDESK_ERROR_ENTRY_DELETED="Error: Entry could not be deleted"
+COM_HELPDESK_ERROR_ENTRY_CHANGE_PUBLISH_STATUS="Error: Could not change publish status"
+COM_HELPDESK_ERROR_VALIDATE_INPUTS="Error: Please validate your inputs"
+COM_HELPDESK_ERROR_UPLOAD="Error with upload"
+
+COM_HELPDESK_ENTRY_NEW_MAIL_SUBJECT="New Helpdesk entry"
+COM_HELPDESK_ENTRY_NEW_MAIL_BODY="A new helpdeskentry has been written"
+
+COM_HELPDESK_COMMENT_SAVED="Comment saved"
+COM_HELPDESK_COMMENT_ERROR_NOT_SAVED="Error: Could not save comment"
View
@@ -53,13 +53,13 @@ function getData()
$app = JFactory::getApplication();
$user =& JFactory::getUser();
- if( JRequest::getVar('retry') == 'true' ) {
+ if ( JRequest::getVar('retry') == 'true' ) {
$this->_data = $this->getTable();
$this->_data->bind($app->getUserState('eb_validation_data'));
}
// Load the data
- if(empty( $this->_data )) {
+ if (empty( $this->_data )) {
$query = ' SELECT * FROM #__helpdesk '.
' WHERE id = '.$this->_id;
$this->_db->setQuery( $query );
@@ -70,7 +70,7 @@ function getData()
$this->_data = $this->getTable();
$this->_data->id = 0;
//Insert name and email of the registred user
- if($user->get('id')) {
+ if ($user->get('id')) {
$this->_data->hname = $user->get('name');;
$this->_data->hmail = $user->get('email');;
}
@@ -96,10 +96,10 @@ function store()
$date =& JFactory::getDate();
// Set Default Values
- if(!$data['id']) {
+ if (!$data['id']) {
$data['hdate'] = $date->toMysql();
$data['published'] = $params->get('default_published', 1);
- if($params->get('enable_log', true)) {
+ if ($params->get('enable_log', true)) {
$data['hip'] = getenv('REMOTE_ADDR');
} else {
$data['hip'] = "0.0.0.0";
@@ -153,7 +153,8 @@ function publish()
return (int)!$status;
}
- function validate(&$data) {
+ function validate(&$data)
+ {
$app = JFactory::getApplication();
$params = &$app->getParams('com_helpdesk');
$user = &JFactory::getUser();
@@ -213,17 +214,18 @@ function validate(&$data) {
}
if ($error) {
- $app->setUserState( 'eb_validation_errors', $errors);
- $app->setUserState( 'eb_validation_data' , $data);
+ $app->setUserState('eb_validation_errors', $errors);
+ $app->setUserState('eb_validation_data' , $data);
return false;
} else {
return true;
}
}
- function savecomment() {
+ function savecomment()
+ {
$row =& $this->getTable();
- $data = JRequest::get( 'post' );
+ $data = JRequest::get('post');
// Bind the form fields to the table
if (!$row->bind($data)) {
Oops, something went wrong.

0 comments on commit 36786fe

Please sign in to comment.