Ejemplo n.º 1
0
	function on_every_time_delete()
	{
		$tc =& $this->get_thor_core();
		$id = $this->get_action_id();
		{
			$elements = $this->get_element_names();
			foreach ($elements as $element_name)
			{
				$this->remove_element($element_name);
			}
		}
		echo '<h3>Are you sure you want to delete row id ' . $id . '?</h3>';
		$this->actions = array('delete' => 'Confirm Delete', 'cancel' => 'Cancel');
		
		$data = $tc->get_values_for_primary_key($this->get_action_id());
		unset ($data['id']); // lets not show the id in this view
		$data = $tc->transform_thor_values_for_display($data);
		
		if ($data)
		{
			// we are going to use Tyr to format this up though it is a little silly ... 
			$tyr = new Tyr();
			$html = $tyr->make_html_table($data, false);
			echo $html;
		}
		else echo '<p>No data to display for this row</p>';
	}
Ejemplo n.º 2
0
		/**
		 * @todo remove tyr dependency - icky.
		 */
		function get_submitted_data_html()
		{
			include_once(TYR_INC.'tyr.php');
			$tyr = new Tyr();
        	$model =& $this->get_model();
			
			$html = '<div class="submitted_data">';
        	$html .= '<h3>You submitted:</h3>';
        	$html .= $tyr->make_html_table($model->get_values_for_show_submitted_data(), false);
        	$html .= '</div>';
        	return $html;
		}
Ejemplo n.º 3
0
	/**
	 * Uses Tyr to send an e-mail, given an array of key value pairs where the key is the item display name, and the value is the value
	 *
	 * The options array can define any of the following keys - if none are defined default behaviors will be used
	 * 
	 * - to: netid, array of netids, or comma separated string indicating who the e-mails should go to
	 * - from: netid or full e-mail address for the from field
	 * - reply-to: netid or full e-mail address for the reply-to field
	 * - subject: string indicating the subject line
	 * - header: string containing header line for the first line of the e-mail
	 * - dislaimer: boolean indicating whether or not to add a dislaimer - defaults to true
	 * - origin_link: link indicating where the URL where the form was filled out
	 * - access_link: link indicating where the form can be accessed for view/edit
	 * - email_empty_fields: boolean indicating whether or not to email empty fields
	 *
	 * @param array data - key/value pairs of the data to e-mail
	 * @param array options - allows various parameters to be optionally passed
	 * @todo remove this weird mini system and the tyr "message" framework and use e-mail class directly
	 */
	function send_email(&$data, $options = array())
	{
		$to = (isset($options['to'])) ? $options['to'] : $this->get_email_of_recipient();
		$to = (is_array($to)) ? implode(",", $to) : $to;
		if (strlen(trim($to)) > 0)
		{
			if (isset($options['origin_link'])) $messages['all']['form_origin_link'] = $options['origin_link'];
			if (isset($options['access_link'])) $messages['all']['form_access_link'] = $options['access_link'];
			$messages['all']['hide_empty_values'] = (isset($options['email_empty_fields'])) ? !$options['email_empty_fields'] : true;
			$messages['all']['form_title'] = (isset($options['header'])) ? $options['header'] : '';
			$messages[0]['to'] = $to;
			$messages[0]['from'] = (isset($options['from'])) ? $options['from'] : TYR_REPLY_TO_EMAIL_ADDRESS;
			$messages[0]['reply-to'] = (isset($options['reply-to'])) ? $options['reply-to'] : TYR_REPLY_TO_EMAIL_ADDRESS;
			$messages[0]['subject'] = (isset($options['subject'])) ? $options['subject'] : 'Response to Form';
			$tyr = new Tyr($messages, $data);
			$tyr->add_disclaimer = (isset($options['disclaimer']) && ($options['disclaimer'] == false) ) ? false : true;
			$tyr->run();
		}
	}