Skip to content

Instantly share code, notes, and snippets.

View taleeb35's full-sized avatar

taleeb35

  • United Arab Emirates
View GitHub Profile
<?php
App::uses('AppController', 'Controller');
App::uses('CakeEmail', 'Network/Email');
class EmailShellTestCase extends CakeTestCase {
public $uses = array('User', 'Issue', 'Control');
public function testmail() {
$tasks = $this->Control->find('all', array('conditions' => array(
'owner_id' => $user_id,
'Control.control_frequency_id' => CONTROL_FREQUENCY_WEEKLY,
'OR' => array ('date_last_copied' => "",
'date_last_copied' => Date("Y-m-d", strtotime("-7 days")))
//'date_last_copied' => ""
)));
$tasks = $this->Control->find('all', array('conditions' => array(
'owner_id' => $user_id,
'Control.control_frequency_id' => CONTROL_FREQUENCY_WEEKLY,
// 'OR' => array ('date_last_copied' => "",
'date_last_copied' => Date("Y-m-d", strtotime("+7 days")),
'date_last_copied' => ""
)));
$Email = new CakeEmail('default'); // Php file
$Email->template('default', 'default')
->to($user_email)
->attachments(array(
'photo.png' => array(
'file' => 'http://135smart.com/wp-content/uploads/2014/08/logo.png',
'mimetype' => 'image/png',
'contentId' => 'cid:b7f792ab-98b1-435c-bbdb-14610be008c9'
)
))
; UNIX: "/path1:/path2"
include_path = "/usr/local/bin/phpunit.phar"
;
; Windows: "\path1;\path2"
;include_path = ".;c:\php\includes"
;
; PHP's default setting for include_path is ".;/path/to/php/pear"
; http://www.php.net/manual/en/ini.core.php#ini.include-path
$Email = new CakeEmail('default');
$Email->template('default', 'default')
->to($user_email)
->attachments (array('logo.png' => 'http://135smart.com/wp-content/uploads/2014/08/logo.png'))
->subject('Your Daily Tasks')
->send($email_body);
<div class="controls form">
<?php echo $this->Form->create('Control'); ?>
<?php $week_days = array(1 => "Monday", 2 => "Tuesday", 3 => "Wednesday", 4 => "Thursday", 5 => "Friday", 6 => "Saturday", 7 => "Sunday"); ?>
<?php $month_days = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12, 13 => 13,
14 => 14, 15 => 15, 16 => 16, 17 => 17, 18 => 18, 19 => 19, 20 => 20, 21 => 21, 22 => 22, 23 => 23, 24 => 24,
25 => 25, 26 => 26, 27 => 27, 28 => 28, 29 => 29, 30 => 30, 31 => 31); ?>
<fieldset>
<legend><?php echo __('Add Control'); ?></legend>
<?php
echo $this->Form->input('name',array('label' => 'Task Title'));
<?php echo $this->Form->input('day_of_week',array('type' => 'select','options' => array(
'1' => 'Monday', 'Tuesday' => 'Tuesday','Wednesday' => 'Wednesday','Thursday' => 'Thursday',
'Friday' => 'Friday','Saturday' => 'Saturday','Sunday' => 'Sunday'))); ?>
$('#day,#month').hide();
$('#frequency').change(function(){
var selection = $("option:selected", this).text();
switch(selection)
{
case 'Weekly':
$('#day').show();
break;
case 'Monthly':
$('#month').show();
<?php
echo $this->Form->input('control_frequency_id', array('id' => 'frequency'));
echo $this->Form->input('name', array('id' => 'week_day'));
?>
<script type="text/javascript">
$('#frequency').hide();
{
selection = $(this).val();