getI18N() public method

Retrieve the i18n instance
public getI18N ( ) : sfI18N
return sfI18N The current sfI18N implementation instance.
 /**
  * Function loads all translations for the textfields and combobox
  *
  * @param user $conext
  * @return array $result
  */
 public function loadAjaxLanguage(sfContext $context) {
     $result = array();
     $result['login'] = $context->getI18N()->__('Login',null,'login');
     $result['username'] = $context->getI18N()->__('Username',null,'login');
     $result['password'] = $context->getI18N()->__('Password',null,'login');
     $result['language'] = $context->getI18N()->__('Language',null,'login');
     $result['close'] = $context->getI18N()->__('Close',null,'login');
     return $result;
 }
Beispiel #2
0
 /**
  * Prepare data for displaxing in grid
  *
  * @param Doctrine_Collection $data, data from database
  * @param sfContext $context
  * @return array $result
  */
 public function buildField(Doctrine_Collection $data, sfContext $context) {
     $result = array();
     $a = 0;
     foreach($data as $item) {
         $result[$a]['#'] = $a+1;
         $result[$a]['id'] = $item->getId();
         $result[$a]['title'] = $item->getTitle();
         $result[$a]['type'] = $context->getI18N()->__($item->getType(),null,'field');
         $write = $item->getWriteprotected() == 1 ? 'yes' : 'no';
         $result[$a++]['writeprotected'] = $context->getI18N()->__($write,null,'field');
     }
     return $result;
 }
    /**
     * Function builds the data for the Extjs Grid, to change the order
     * of circulation overview Columns.
     *
     * @param array $data
     * @param sfContext, Context symfony object
     * @return array $data, resultset
     */
    public function buildUserColumns(array $data, sfContext $context) {
        for($a = 0;$a<count($data);$a++) {
            $data[$a]['column'] = $data[$a]['columntext'];
            $data[$a]['columntext'] = $context->getI18N()->__($data[$a]['columntext'],null,'systemsetting');

        }
        return $data;
    }
 /**
  * Sets culture.
  *
  * @param  string $culture culture
  */
 public function setCulture($culture)
 {
     if ($this->culture != $culture) {
         $this->culture = $culture;
         // change the message format object with the new culture
         if (sfConfig::get('sf_i18n')) {
             $this->context->getI18N()->setCulture($culture);
         }
         // add the culture in the routing default parameters
         sfConfig::set('sf_routing_defaults', array_merge((array) sfConfig::get('sf_routing_defaults'), array('sf_culture' => $culture)));
     }
 }
    /**
     * Send an email, when workflow is started in the future
     *
     * @param UserMailSettings $userSettings, Object that contains useragent settings
     * @param sfContext $controller
     * @param array $workflowVersion, workflowversion details
     * @param array $workflowTemplate, workfowtemplate detials
     * @param String $serverUrl , url of the server,
     */
    public function  __construct(UserMailSettings $userSettings, sfContext $controller, array $workflowVersion, array $workflowTemplate, $serverUrl) {
        $sf_i18n = $controller->getI18N();
        $sf_i18n->setCulture($userSettings->userSettings['language']);

        $content['text'] = $controller->getI18N()->__('Your workflow' ,null,'createworkflow') . ' '. $workflowTemplate[0]['name'] . ' ' . $controller->getI18N()->__('has been started' ,null,'createworkflow');
        
        $this->setSender($userSettings->userSettings['systemreplyaddress']);
        $this->setReceiver(array ($userSettings->userData['email'] => $userSettings->userData['firstname'] . ' ' . $userSettings->userData['lastname']));

        $subject = $controller->getI18N()->__('CuteFlow: workflow started' ,null,'createworkflow');
        $this->setSubject($subject);
        $linkTo = $controller->getI18N()->__('Direct link to workflow' ,null,'createworkflow');
        $this->setContentType('text/' . $userSettings->userSettings['emailformat']);
        $bodyData = array('text' => $content['text'],
                          'userid' => $userSettings->userData['user_id'],
                          'workflow' => $workflowVersion,
                          'serverPath' => $serverUrl,
                          'linkto'  => $linkTo
                          );
        $this->setBody(get_partial('createworkflow/' . $userSettings->userSettings['emailformat'] . 'StartWorkflowInFuture', $bodyData));
        $this->sendEmail();
    }
    public function  __construct(UserMailSettings $userSettings, sfContext $controller, array $openWorkflows, $serverUrl) {
        $sf_i18n = $controller->getI18N();
        $sf_i18n->setCulture($userSettings->userSettings['language']);

        $content['text'] = $controller->getI18N()->__('You need to complete the following workflows' ,null,'sendreminderemail');
        $this->setSender($userSettings->userSettings['systemreplyaddress']);
        $this->setReceiver(array ($userSettings->userData['email'] => $userSettings->userData['firstname'] . ' ' . $userSettings->userData['lastname']));
        $subject = $controller->getI18N()->__('CuteFlow: open workflows' ,null,'sendreminderemail');
        $worfklowname = $controller->getI18N()->__('Workflowname' ,null,'sendreminderemail');
        $linkTo = $controller->getI18N()->__('Direct link to workflow' ,null,'sendreminderemail');
        $this->setSubject($subject);
        $this->setContentType('text/' . $userSettings->userSettings['emailformat']);
        $bodyData = array('text' => $content['text'], 
                          'workflow' => $openWorkflows['workflows'],
                          'workflowname' => $worfklowname,
                          'userid' => $userSettings->userData['user_id'],
                          'serverPath' => $serverUrl,
                          'linkto' => $linkTo
                          );
        
        $this->setBody(get_partial('sendreminderemail/' . $userSettings->userSettings['emailformat'], $bodyData));
        $this->sendEmail();
    }
 /**
  * Function creates data for displaying all additional textes in datagrid
  * 
  * @param Doctrine_Collection $data, all records for grid
  * @param sfContext $context, context object
  * @return array $resultset, resultset.
  */
 public function buildAllText(Doctrine_Collection $data, sfContext $context) {
     $a = 0;
     $result = array();
     foreach($data as $item) {
         $result[$a]['#'] = $a+1;
         $result[$a]['title'] = $item->getTitle();
         $result[$a]['contenttype'] = $context->getI18N()->__($item->getContenttype(),null,'additionaltext');
         $result[$a]['rawcontenttype'] = $item->getContenttype();
         $result[$a]['content'] = $item->getContent();
         $result[$a]['isactive'] = $item->getIsactive();
         $result[$a++]['id'] = $item->getId();
     }
     return $result;
 }
Beispiel #8
0
 /**
  *
  * Generates the columns for grid, in workflow overivew, todo and archvie
  *
  * @param array $data, columns
  * @param sfContext $context, context
  * @return array $result
  */
 public function generateUserWorklowView(array $data, sfContext $context) {
     sfLoader::loadHelpers('I18N');
     $a = 0;
     foreach($data as $item) {
         $result[$a]['columntext'] = $item['columntext'];
         $result[$a]['hidden'] = $item['isactive'] == 'true' ? 'false' : 'true';
         $result[$a]['fieldid'] = -1;
         $result[$a]['text'] = $context->getI18N()->__($item['columntext'] ,null,'systemsetting');
         switch($item['columntext']) {
             case 'NAME':
                 $result[$a]['store'] = 'name';
                 $result[$a]['width'] = '140';
                 break;
             case 'STATION':
                 $result[$a]['store'] = 'currentstation';
                 $result[$a]['width'] = '180';
                 break;
             case 'DAYS':
                 $result[$a]['store'] = 'stationrunning';
                 $result[$a]['width'] = '130';
                 break;
             case 'START':
                 $result[$a]['store'] = 'versioncreated_at';
                 $result[$a]['width'] = '120';
                 break;
             case 'SENDER':
                 $result[$a]['store'] = 'sendername';
                 $result[$a]['width'] = '200';
                 break;
             case 'TOTALTIME':
                 $result[$a]['store'] = 'currentlyrunning';
                 $result[$a]['width'] = '80';
                 break;
             case 'MAILINGLIST':
                 $result[$a]['store'] = 'mailinglisttemplate';
                 $result[$a]['width'] = '150';
                 break;
             case 'USERDEFINED1':
                 if($item['field_id'] != '' AND is_numeric($item['field_id']) == true AND $item['isactive'] == 'true') {
                     $fieldName = FieldTable::instance()->getFieldById($item['field_id']);
                     $result[$a]['text'] = $fieldName[0]->getTitle();
                     $result[$a]['store'] = 'userdefined1';
                     $result[$a]['fieldid'] = $item['field_id'];
                     $result[$a]['width'] = '100';
                 }
                 else {
                     $result[$a]['width'] = '100';
                     $result[$a]['store'] = 'userdefined1';
                 }
                 break;
             case 'USERDEFINED2':
                 if($item['field_id'] != '' AND is_numeric($item['field_id']) == true AND $item['isactive'] == 'true') {
                     $fieldName = FieldTable::instance()->getFieldById($item['field_id']);
                     $result[$a]['text'] = $fieldName[0]->getTitle();
                     $result[$a]['store'] = 'userdefined2';
                     $result[$a]['fieldid'] = $item['field_id'];
                     $result[$a]['width'] = '100';
                 }
                 else {
                     $result[$a]['width'] = '100';
                     $result[$a]['store'] = 'userdefined2';
                 }
                 break;
         }
         $a++;
     }
     //unset($result[7]);
     //unset($result[8]);
     return $result;
     
 }
 /**
  * Creates all Versions for the grid popup
  * @param Doctrine_Collection $data, data
  * @param string $culture, current culture of user
  * @param sfContext, $context
  * @return array $result, data
  */
 public function buildAllVersion(Doctrine_Collection $data, $culture, sfContext $context) {
     $result = array();
     $a = 0;
     foreach($data as $item) {
         $template = $item->getDocumenttemplateTemplate();
         $result[$a]['#'] = $a+1;
         $result[$a]['id'] = $item->getId();
         $result[$a]['activeversion'] = $item->getActiveversion() == 1 ? '<font color="green">' . $context->getI18N()->__('Yes' ,null,'documenttemplate') . '</font>' : '<font color="red">' . $context->getI18N()->__('No',null,'documenttemplate') . '</font>';
         $result[$a]['created_at'] = format_date($item->getCreatedAt(), 'g', $culture);
         $result[$a]['name'] = $template[0]->getName();
         $result[$a++]['documenttemplate_id'] = $item->getDocumenttemplateId();
     }
     return $result;
 }
    public function getFieldItems(WorkflowSlotField $field, $type, sfContext $context, $versionid) {
        $result = array();
        $a = 0;
        switch ($type) {
            case 'TEXTFIELD':
                $items = WorkflowSlotFieldTextfieldTable::instance()->getAllItemsByWorkflowFieldId($field->getId())->toArray();
                $fieldData = FieldTextfieldTable::instance()->getTextfieldByFieldId($field->getFieldId())->toArray();
                $replaceObj = new ReplaceTags($versionid, $items[0]['value'], $this->culture, $context);
                $value = $replaceObj->getText();
                $result['value'] = $value;
                $result['regex'] = $fieldData[0]['regex'];
                $result['id'] = $items[0]['id'];
                break;
            case 'CHECKBOX':
                $items = WorkflowSlotFieldCheckboxTable::instance()->getAllItemsByWorkflowFieldId($field->getId())->toArray();
                $result['value'] = $items[0]['value'];
                $result['id'] = $items[0]['id'];
                break;
            case 'NUMBER':
                $items = WorkflowSlotFieldNumberTable::instance()->getAllItemsByWorkflowFieldId($field->getId())->toArray();
                $fieldData = FieldNumberTable::instance()->getNumberByFieldId($field->getFieldId())->toArray();
                if($fieldData[0]['comboboxvalue'] != 'EMPTY') {
                    $result['emptytext'] = $context->getI18N()->__($fieldData[0]['comboboxvalue'] ,null,'field');
                }
                else {
                    $result['emptytext'] = $fieldData[0]['regex'];
                }
                $result['value'] = $items[0]['value'];
                $result['regex'] = $fieldData[0]['regex'];
                $result['id'] = $items[0]['id'];
                break;
            case 'DATE':
                $items = WorkflowSlotFieldDateTable::instance()->getAllItemsByWorkflowFieldId($field->getId())->toArray();
                $format = FieldDateTable::instance()->getDateByFieldId($field->getFieldId())->toArray();
                $result['value'] = $items[0]['value'];
                $result['dateformat'] = $format[0]['dateformat'];
                $result['regex'] = $format[0]['regex'];
                $result['id'] = $items[0]['id'];
                break;
            case 'TEXTAREA':
                $items = WorkflowSlotFieldTextareaTable::instance()->getAllItemsByWorkflowFieldId($field->getId())->toArray();
                $textarea = FieldTextareaTable::instance()->getTextareaById($field->getFieldId())->toArray();
                $result['value'] = $items[0]['value'];
                $result['contenttype'] = $textarea[0]['contenttype'];
                $result['id'] = $items[0]['id'];
                break;
            case 'RADIOGROUP':
                $items = WorkflowSlotFieldRadiogroupTable::instance()->getAllItemsByWorkflowFieldId($field->getId());
                foreach($items as $item) {
                    $name = FieldRadiogroupTable::instance()->getRadiogroupItemById($item->getFieldradiogroupId())->toArray();
                    $result[$a]['value'] = $item->getValue();
                    $result[$a]['id'] = $item->getId();
                    $result[$a++]['name'] = $name[0]['value'];
                }
                break;
            case 'CHECKBOXGROUP':
                $items = WorkflowSlotFieldCheckboxgroupTable::instance()->getAllItemsByWorkflowFieldId($field->getId());
                foreach($items as $item) {
                    $name = FieldCheckboxgroupTable::instance()->getCheckboxgroupItemById($item->getFieldcheckboxgroupId())->toArray();
                    $result[$a]['value'] = $item->getValue();
                    $result[$a]['id'] = $item->getId();
                    $result[$a++]['name'] = $name[0]['value'];
                }
                break;
            case 'COMBOBOX':
                $items = WorkflowSlotFieldComboboxTable::instance()->getAllItemsByWorkflowFieldId($field->getId());
                foreach($items as $item) {
                    $name = FieldComboboxTable::instance()->getComboboxItemById($item->getFieldcomboboxId())->toArray();
                    $result[$a]['value'] = $item->getValue();
                    $result[$a]['id'] = $item->getId();
                    $result[$a++]['name'] = $name[0]['value'];
                }
                break;
            case 'FILE':

                $file = WorkflowSlotFieldFileTable::instance()->getAllItemsByWorkflowFieldId($field->getId())->toArray();
                $workflowtemplate = WorkflowVersionTable::instance()->getWorkflowVersionById($versionid)->toArray();
                $result['filepath'] = sfConfig::get('sf_upload_dir') . '/' . $workflowtemplate[0]['workflowtemplate_id'] . '/' . $versionid . '/' . $file[0]['hashname'] ;
                $result['hashname'] = $file[0]['hashname'];
                $result['filename'] = $file[0]['filename'];
                $url = $this->serverUrl . '/file/ShowAttachment';
                $plainUrl = $this->serverUrl . '/file/ShowAttachment';
                $url .= '/workflowid/' .  $workflowtemplate[0]['workflowtemplate_id'] . '/versionid/' . $versionid. '/attachmentid/' . $file[0]['id'] . '/file/1';
                $plainUrl .= '/workflowid/' .  $workflowtemplate[0]['workflowtemplate_id'] . '/versionid/' . $versionid. '/attachmentid/' . $file[0]['id'] . '/file/1';
                $result['plainurl'] = $plainUrl;
                $result['url'] = $url;
                $result['link'] = '<a href="'.$url.'" target="_blank">'.$result['filename'].'</a>';
                break;
        }
        return $result;
    }
    /**
     *
     * @param sfContext $context
     * @return <type>
     */
    public function getDate($context) {
        $result = array();
        $a = 0;
        $hour[0]['name'] =  $context->getI18N()->__('01:00' ,null,'cronjobsetting');
        $hour[1]['name'] =  $context->getI18N()->__('02:00' ,null,'cronjobsetting');
        $hour[2]['name'] =  $context->getI18N()->__('03:00' ,null,'cronjobsetting');
        $hour[3]['name'] =  $context->getI18N()->__('04:00' ,null,'cronjobsetting');
        $hour[4]['name'] =  $context->getI18N()->__('05:00' ,null,'cronjobsetting');
        $hour[5]['name'] =  $context->getI18N()->__('06:00' ,null,'cronjobsetting');
        $hour[6]['name'] =  $context->getI18N()->__('07:00' ,null,'cronjobsetting');
        $hour[7]['name'] =  $context->getI18N()->__('08:00' ,null,'cronjobsetting');
        $hour[8]['name'] =  $context->getI18N()->__('09:00' ,null,'cronjobsetting');
        $hour[9]['name'] =  $context->getI18N()->__('10:00' ,null,'cronjobsetting');
        $hour[10]['name'] =  $context->getI18N()->__('11:00' ,null,'cronjobsetting');
        $hour[11]['name'] =  $context->getI18N()->__('12:00' ,null,'cronjobsetting');
        $hour[12]['name'] =  $context->getI18N()->__('13:00' ,null,'cronjobsetting');
        $hour[13]['name'] =  $context->getI18N()->__('14:00' ,null,'cronjobsetting');
        $hour[14]['name'] =  $context->getI18N()->__('15:00' ,null,'cronjobsetting');
        $hour[15]['name'] =  $context->getI18N()->__('16:00' ,null,'cronjobsetting');
        $hour[16]['name'] =  $context->getI18N()->__('17:00' ,null,'cronjobsetting');
        $hour[17]['name'] =  $context->getI18N()->__('18:00' ,null,'cronjobsetting');
        $hour[18]['name'] =  $context->getI18N()->__('19:00' ,null,'cronjobsetting');
        $hour[19]['name'] =  $context->getI18N()->__('20:00' ,null,'cronjobsetting');
        $hour[20]['name'] =  $context->getI18N()->__('21:00' ,null,'cronjobsetting');
        $hour[21]['name'] =  $context->getI18N()->__('22:00' ,null,'cronjobsetting');
        $hour[22]['name'] =  $context->getI18N()->__('23:00' ,null,'cronjobsetting');
        $hour[23]['name'] =  $context->getI18N()->__('24:00' ,null,'cronjobsetting');

        $hour[0]['value'] =  '01';
        $hour[1]['value'] =  '02';
        $hour[2]['value'] =  '03';
        $hour[3]['value'] =  '04';
        $hour[4]['value'] =  '05';
        $hour[5]['value'] =  '06';
        $hour[6]['value'] =  '07';
        $hour[7]['value'] =  '08';
        $hour[8]['value'] =  '09';
        $hour[9]['value'] =  '10';
        $hour[10]['value'] =  '11';
        $hour[11]['value'] =  '12';
        $hour[12]['value'] =  '13';
        $hour[13]['value'] =  '14';
        $hour[14]['value'] =  '15';
        $hour[15]['value'] =  '16';
        $hour[16]['value'] =  '17';
        $hour[17]['value'] =  '18';
        $hour[18]['value'] =  '19';
        $hour[19]['value'] =  '20';
        $hour[20]['value'] =  '21';
        $hour[21]['value'] =  '22';
        $hour[22]['value'] =  '23';
        $hour[23]['value'] =  '24';
        return $hour;
    }