عمل مواعيد

منتدى دعم جوملا! 1.5

Moderators: sherif, General Support Moderators

Locked
rasha123
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Sun Mar 11, 2012 8:22 am

عمل مواعيد

Post by rasha123 » Sun Mar 11, 2012 9:01 am

السلام عليكم

انا بحاول اعمل فورم لمواعيد الدكاترة
بهذه الطريقة
Patient's Name
Appointment Date calendar
Appointment Time
Mobile Number
Best Time to Call Back
Alternate Date calendar
Alternate Time
Choose Doctor <اسماء الدكاترة من جدول

بس المشكلة عندي انو كل الطلبات تترسل على ايميل واحد
انا ابغى انو عند اختيار اي دكتو يترسل الطلب على ايميله
هدا الكود اتمنى احد يساعدني لانو معرفتي بال php ضعيفة

<?php

defined('_JEXEC') or die();

jimport( 'joomla.application.component.model' );

class AppointmentModelAppointment extends JModel
{
function getDoctorName($id)
{
$query = 'SELECT firstname,lastname FROM #__doctor WHERE id='.$id;
$this->_db->setQuery( $query );
$rows = $this->_db->loadObjectList();
$FullName=$rows[0]->firstname." ".$rows[0]->lastname;
return $FullName;
}
function getDoctor3()
{
$query = 'SELECT id AS value,CONCAT(firstname,lastname) as text FROM #__doctor ORDER by firstname';
$doctors[] = JHTML::_('select.option', '0', JText::_( 'Select Prefrence' ));
$this->_db->setQuery($query);
$doctors = array_merge($doctors, $this->_db->loadObjectList());
$lists = JHTML::_('select.genericlist', $doctors,'prefrence', ' class="inputbox" style="width:150px;" size="1"', 'value', 'text','');
return $lists;
}
function store()
{
global $mainframe;
$row =& $this->getTable();
$data = JRequest::get( 'post' );
// Bind the form fields to the appointment table
if (!$row->bind($data))
{
$this->setError($this->_db->getErrorMsg());
return false;
}

// Make sure the appointment record is valid
if (!$row->check()) {
$this->setError($this->_db->getErrorMsg());
return false;
}

// Store the web link table to the database
if (!$row->store()) {
$this->setError( $row->getErrorMsg() );
return false;
}
$this->sendmail($data);
$mainframe->redirect("index2.php?option=com_content&view=article&id=110&Itemid=144");
return true;
}
function sendmail($post)
{
global $mainframe;
$mailfrom = $mainframe->getCfg( 'mailfrom' );
$fromname = $mainframe->getCfg( 'fromname' );
$email="[email protected]";
$subject="New Appointment";
$message='<table width="100%" border="0">
<tr>
<td><b>'.JText::_("Patient's Name").'</b></td>
<td>'.$post['patientname'].'</td>
</tr>
<tr>
<td><b>'.JText::_("Appointment Date").'</b></td>
<td>'.$post['appointmentdate'].'</td>
</tr>
<tr>
<td><b>'.JText::_("Appointment Time").'</b></td>
<td>'.$post['appointmenttime'].'</td>
</tr>
<tr>
<td><b>'.JText::_("Mobile Number").'</b></td>
<td>'.$post['mobile'].'</td>
</tr>
<tr>
<td><b>'.JText::_("Best Time to Call Back").'</b></td>
<td>'.$post['callbacktime'].'</td>
</tr>
<tr>
<td><b>'.JText::_("Alternate Date").'</b></td>
<td>'.$post['alternatedate'].'</td>
</tr>
<tr>
<td><b>'.JText::_("Alternate Time").'</b></td>
<td>'.$post['preferredtime1'].'</td>
</tr>

<tr>
<td><b>'.JText::_("Prefrence").'</b></td>
<td>'.$this->getDoctorName($post['prefrence']).'</td>
</tr>
</table>';

JUtility::sendMail($mailfrom, $fromname, $email, $subject, $message,$mode=1);
}
}

Locked

Return to “1.5 !جوملا”