function save($check_notify = FALSE) { if (isset($_POST['email_recipients']) && is_array($_POST['email_recipients'])) { $this->email_recipients = base64_encode(serialize($_POST['email_recipients'])); } parent::save($check_notify); }
static function trace($data = '', $file_name = '') { is_object($data) and $data = basic::object_array($data); is_array($data) and $data = print_r($data, true); empty($file_name) and $file_name = date('Y_m_d') . '.log'; $file = fopen(LOG_TRACE . $file_name, 'a+'); flock($file, LOCK_EX); fwrite($file, $data . PHP_EOL); flock($file, LOCK_UN); fclose($file); }
public function actionRemoveSingleData($id) { $model = NominalRollDetail::model()->findByPk($id); $UserData = Sewadars::model()->findByPk($model->sewadar_id); if ($UserData->gender == 'FEMALE') { basic::removeTotalSewadarCount($model->nominal_roll_id, 'Female'); } else { basic::removeTotalSewadarCount($model->nominal_roll_id, 'Male'); } if ($model->delete()) { Yii::app()->user->setFlash('success', 'Sewadar Removed Successfully'); $this->redirect(array('update', 'id' => $model->nominal_roll_id)); } }
<div class="container"> <h2>Please Select Area Where You Want To Send Sewa</h2> <div class="span-10"> <?php $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'nominal-roll-form-register-area', 'enableAjaxValidation' => false)); ?> <div class="form-data"> <label for="SatsangCentre_centre_name" class="required">Area </label> <?php $area = CHtml::ListData(basic::getAreas(), 'area_id', 'area_name'); echo CHtml::dropDownList('area', '', $area, array('empty' => 'Select An Area')); ?> </div> <div class="form-data"> <label for="SatsangCentre_centre_name" class="required">Centre</label> <?php $centre = CHtml::ListData(basic::getSatsangCentre(), 'centre_id', 'centre_name'); echo CHtml::dropDownList('centre', '', $centre, array('empty' => 'Select a Centre')); ?> </div> <div class="form-data submit"> <?php echo CHtml::submitButton('submit'); ?> </div> <?php $this->endWidget(); ?> </div>
?> <?php echo $form->textFieldRow($model, 'centre_name', array('class' => 'span5', 'maxlength' => 45)); ?> <?php echo $form->textFieldRow($model, 'centre_secretary_name', array('class' => 'span5', 'maxlength' => 45)); ?> <?php echo $form->textFieldRow($model, 'centre_secretary_mobile_number', array('class' => 'span5', 'maxlength' => 45)); ?> <?php //echo $form->textFieldRow($model,'centre_code',array('class'=>'span5','maxlength'=>45)); ?> <?php echo $form->dropDownListRow($model, 'area_id', CHtml::listData(basic::getAreas(), 'area_id', 'area_name')); ?> <div class="form-actions"> <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => $model->isNewRecord ? 'Save' : 'Update')); ?> <input type="button" name="cancel" class="btn btn-primary" value="Cancel" onclick="javascript:window.history.back()"> </div> <?php $this->endWidget();
static function index() { $captcha = basic::code(5); session::set('captcha', $captcha); s_picture::code($captcha, 90, 44); }
static function uuid() { $md5 = md5(basic::microtime() . rand(100, 999)); return substr($md5, 0, 8) . '-' . substr($md5, 9, 4) . '-' . substr($md5, 9, 4) . '-' . substr($md5, 9, 4) . '-' . substr($md5, -12); }
function _startToParse() { //Load php's XML parser $this->xml_parser = xml_parser_create(); xml_set_object($this->xml_parser, $this); //Parser option: Skip whitespace xml_parser_set_option($this->xml_parser, XML_OPTION_SKIP_WHITE, true); //Parser option: Case folding off xml_parser_set_option($this->xml_parser, XML_OPTION_CASE_FOLDING, false); //Set callback functions xml_set_element_handler($this->xml_parser, "_startTagProcessor", "_endTagProcessor"); xml_set_character_data_handler($this->xml_parser, "_charDataProcessor"); //Read XML file if (!($fp = fopen($this->xml_file, 'r'))) { basic::error('Fatal error', "File I/O error: {$this->xml_file}"); } //Parse XML while ($data = fread($fp, 4096)) { //error... :( if (!xml_parse($this->xml_parser, $data, feof($fp))) { $ec = xml_get_error_code($this->xml_parser); basic::error('Fatal error', "XML parser error (error code " . $ec . "): " . xml_error_string($ec) . "\nThe error was found on line: " . xml_get_current_line_number($this->xml_parser)); } } //free your mind, and the rest will follow :) xml_parser_free($this->xml_parser); }
/** * Manages all models. */ public function actionAdmin() { $basic = new basic(); $sections = $basic->getSewadarSections(); $age = $basic->getAgeRange(); $bloodGroup = basic::getBloodGroup(); $model = new Sewadars('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['Sewadars'])) { $model->attributes = $_GET['Sewadars']; } $this->render('admin', array('model' => $model, 'sections' => $sections, 'age' => $age, 'bloodGroup' => $bloodGroup)); }
function extract() { Basic::printToConsole("\n\nExtracting the gunzipped file...", false); //Open the downloaded gunzip file if (!($file = gzopen($this->filename . ".u8.gz", "r"))) { basic::error('Fatal error', 'I/O error! Could not open the downloaded file!'); } //Open the file we write to if (!($openfile = fopen($this->filename, 'a'))) { basic::error('Fatal error', 'Cannot open the file (' . $this->filename . ')'); } //Write the data while (!gzeof($file)) { $buff = gzgets($file, 4096); fputs($openfile, $buff); } fclose($openfile); gzclose($file); Basic::printToConsole("\n\n " . strtoupper($this->filename) . ".U8.GZ WAS SUCCESSFUL EXTRACTED! \n Filename: " . $this->filename . "\n"); }
static function truncate($data, $length, $from = 0) { return basic::truncate($data, $length, $from); }
function close() { if (!mysql_close()) { basic::Error('Fatal error', 'Could not close connection to the database!'); } }
$memberRank->select($memberRankID); $rankPrivileges = $memberRank->get_privileges(); $strPrivileges = implode(",", $rankPrivileges); $result = $mysqli->query("SELECT * FROM " . $mysqli->get_tablePrefix() . "consolecategory ORDER BY ordernum"); while ($row = $result->fetch_assoc()) { $arrConsoleCats[] = $row['consolecategory_id']; } $arrFullySortedConsole = array(); $consoleObj = new ConsoleOption($mysqli); foreach ($rankPrivileges as $consoleoption) { $consoleObj->select($consoleoption); $consoleInfo = $consoleObj->get_info(); $sortNum = array_search($consoleInfo['consolecategory_id'], $arrConsoleCats); $arrFullySortedConsole[$sortNum][] = $consoleoption; } $consoleCatObj = new basic($mysqli, "consolecategory", "consolecategory_id"); foreach ($arrConsoleCats as $key => $categoryID) { $consoleCatObj->select($categoryID); $consoleCatInfo = $consoleCatObj->get_info(); echo "<b>" . $consoleCatInfo['name'] . "</b>"; echo "<br>"; $arrConsoleOptions = $arrFullySortedConsole[$key]; foreach ($arrConsoleOptions as $consoleOptionID) { $consoleObj->select($consoleOptionID); $consoleInfo = $consoleObj->get_info(); echo " - " . $consoleInfo['pagetitle'] . "<br>"; } } } } if ($LOGIN_FAIL) {