Skip to content

Commit

Permalink
update embed and ysUtil
Browse files Browse the repository at this point in the history
  • Loading branch information
exiang committed Jul 19, 2020
1 parent 4ddaf9e commit e8971c7
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 4 deletions.
2 changes: 1 addition & 1 deletion protected/models/Embed.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static function model($class = __CLASS__)
return parent::model($class);
}

public function code2value($code, $attribute = '', $exceptionIfNotFound = false)
public static function code2value($code, $attribute = '', $exceptionIfNotFound = false)
{
return self::getByCode($code, $attribute, $exceptionIfNotFound);
}
Expand Down
2 changes: 1 addition & 1 deletion protected/models/EmbedBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function rules()
return array(
array('code, is_title_enabled, is_text_description_enabled, is_html_content_enabled, is_image_main_enabled, is_default', 'required'),
array('is_title_enabled, is_text_description_enabled, is_html_content_enabled, is_image_main_enabled, is_default, date_added, date_modified', 'numerical', 'integerOnly' => true),
array('code', 'length', 'max' => 32),
array('code', 'length', 'max' => 128),
array('title_en, title_ms, title_zh, image_main_en, image_main_ms, image_main_zh', 'length', 'max' => 255),
array('text_description_en, text_description_ms, text_description_zh, html_content_en, html_content_ms, html_content_zh, text_note', 'safe'),
array('imageFile_main_en, imageFile_main_ms, imageFile_main_zh', 'file', 'types' => 'jpg, jpeg, png, gif', 'allowEmpty' => true),
Expand Down
4 changes: 3 additions & 1 deletion protected/models/HUB.php
Original file line number Diff line number Diff line change
Expand Up @@ -1527,6 +1527,8 @@ public static function sendNotify($userType, $username, $message, $title = '', $
$notify->message = $jsonPayload->msg;
$notify->jsonArray_payload = $jsonPayload;

// sendBehalfName and sendBehalfEmail

// send sms
if ($notify->hasSms) {
$tmp = self::sendSms($notify->receiverMobileNo, $jsonPayload->msg);
Expand Down Expand Up @@ -1568,7 +1570,7 @@ public static function sendEmail($email, $name, $title, $content, $options = arr
}
}

return ysUtil::sendMail($receivers, $title, $content);
return ysUtil::sendMail($receivers, $title, $content, $options);
}

//
Expand Down
35 changes: 35 additions & 0 deletions protected/models/NotifyMaker.php
Original file line number Diff line number Diff line change
Expand Up @@ -586,4 +586,39 @@ public static function event_sendPostEventSurvey6Months($eventTitle, $eventId, $

return $return;
}

// This function is to replace placeholders in the views with variables
public static function organization_submitNtisForm($organization, $ntisFormSolution, $userEmail, $scoring=99)
{
// Declare contents
$S1CapacityProgrammes="MaGIC Bootcamp, MaGIC workshop, MaGIC Grill & Chill and etc ";
$S1Agency="Malaysian Global Innovation & Creativity Centre";
$S2CapacityProgrammes="TPM Innovation Incubation Centre";
$S2Agency="Technology Park Malaysia(TPM)";

$return['title'] = $return['message'] = Yii::t('notify', "Thanks for your submission", array('{title}' => $organization->title));

// variables in the email to be declared and passed here. Check Yuan's document.
$params['organizationTitle'] = $organization->title;
$params['applicationSerialNo'] = $ntisFormSolution->code;
$params['userEmail'] = $userEmail;

// REJECTED
if($scoring==1){
$params['capacityProgrammes'] = $S1CapacityProgrammes;
$params['agency'] = $S1Agency;
$return['title'] = "NTIS Application Status Result";
$return['content'] = Yii::app()->getController()->renderPartial('application.modules.ntis.views._email.admin_rejectNtisFormSolution', $params, true);
// REJECTED
}elseif($scoring==2){
$params['capacityProgrammes'] = $S2CapacityProgrammes;
$params['agency'] = $S2Agency;
$return['title'] = "NTIS Application Status Result";
$return['content'] = Yii::app()->getController()->renderPartial('application.modules.ntis.views._email.admin_rejectNtisFormSolution', $params, true);
}else{
$return['content'] = Yii::app()->getController()->renderPartial('application.modules.ntis.views._email.admin_approveNtisFormSolution', $params, true);
}

return $return;
}
}
2 changes: 1 addition & 1 deletion protected/modules/journey/JourneyModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public function getNavItems($controller, $forInterface)

return array(
array(
'label' => Yii::t('app', 'Journey'), 'url' => array('/journey/backend/admin'), 'visible' => Yii::app()->user->getState('accessBackend') == true,
'label' => Yii::t('app', 'Journey'), 'url' => array('/journey/backend/admin'), 'visible' => Yii::app()->user->getState('accessBackend') == true && HUB::roleCheckerAction(Yii::app()->user->getState('rolesAssigned'), (object)['id' => 'backend', 'action' => (object)['id' => 'admin'], 'module' => (object)['id' => 'journey']]),
'active' => $controller->activeMenuMain == 'journey' ? true : false,
),
);
Expand Down

0 comments on commit e8971c7

Please sign in to comment.