StdClass PHP Class Code Examples

This page contains top rated real world PHP examples of class StdClass extracted from open source projects. You can rate examples to help us improve the quality of examples

Example #1
Show file File: AdminChallengeController.php Project: barronkid/football-challenge
0
 static function challenge_add()
 {
     if (self::checkPerms()) {
         // Let's create our new challenge
         $db = option('db');
         $log = option('log');
         $current_week = $_POST['current-week'];
         $insert = 'INSERT INTO {{challenges}} VALUES (NULL, "%s", %d, %d, 0, %d, %d, %d, %d, %d, %d, 0)';
         $user_challenges = array();
         list($challenges, $first_start) = self::process_challenges($_POST, $db, $log);
         $queries = array();
         foreach ($challenges as $value) {
             $now = time();
             $queries[] = $db->formatQuery($insert, $value['gid'], $value['home_id'], $value['away_id'], $current_week, FC_YEAR, $first_start, $value['date'], $now, $now);
             $temp = new StdClass();
             $temp->cid = $db->insert_id;
             $temp->sid = FC_DEFAULT_VALUE;
             $user_challenges[] = $temp;
         }
         // When adding a new challenge, give every user a submission object where the sid is set to zero.
         // This will have a few great effects;
         // first, it will make the homepage links work always for picks
         // second, it will make the new standings work, without error protection from missing submissions
         // third, it will mean that there is never a missing submission
         $users = option('all_users');
         foreach ($users as $user) {
             $challenge = new StdClass();
             $challenge->user = $user->username;
             $challenge->week = $current_week;
             $challenge->challenges = $user_challenges;
             $challenge = serialize($challenge);
             $key = sprintf('%s-%s-%s', $user->username, FC_YEAR, $current_week);
             $queries[] = $db->formatQuery('INSERT INTO {{submissions}} VALUES ("%s", "%s", %s, "%s", "%s", "%s")', $key, $user->username, $user->uid, $current_week, FC_YEAR, $db->escape_string($challenge));
             $queries[] = $db->formatQuery('UPDATE {{users}} SET submission = 0 WHERE uid = %s', $user->uid);
         }
         // When creating a challenge, check to see if we should truncate the messages database
         if (FC_MSGS_TRUNCATE) {
             $truncate_week = $current_week - FC_MSGS_TRUNCATE;
             $queries[] = $db->formatQuery('UPDATE {{messages}} SET active = 0 WHERE week <= %s', $truncate_week);
             $log->log('message', sprintf('Truncating messages for week %s', $truncate_week));
         }
         $count = count($queries);
         $i = 1;
         if ($count > 0) {
             foreach ($queries as $query) {
                 if ($result = $db->qry($query)) {
                     $log->log('message', sprintf('Creating challenges, query %s of %s', $i++, $count));
                 } else {
                     $log->log('error', 'Problem while creating challenge', $db->error);
                 }
             }
         } else {
             flash('error:create challenge count', 'No queries for creating a challenge.');
             $log->log('error', 'No queries for creating a challenge.');
         }
         redirect_to('/commissioner');
     } else {
         halt(FORBIDDEN);
     }
 }
Example #2
Show file File: jcommentsobjectgroup.php Project: carmerin/cesae-web
0
 protected function getOptions()
 {
     $options = array();
     $db = JFactory::getDBO();
     $db->setQuery('SELECT DISTINCT `element` FROM `#__extensions` WHERE `type` = "component" ORDER BY `element`;');
     $components = $db->loadResultArray();
     $plugins = JFolder::files(JPATH_SITE . '/components/com_jcomments/plugins/', '\\.plugin\\.php', true, false);
     if (is_array($plugins)) {
         foreach ($plugins as $plugin) {
             $pluginName = str_replace('.plugin.php', '', $plugin);
             foreach ($components as $component) {
                 if ($pluginName == $component || strpos($pluginName, $component . '_') !== false) {
                     $o = new StdClass();
                     $o->value = $pluginName;
                     $o->text = $pluginName;
                     $options[] = $o;
                 }
             }
         }
     } else {
         $o = new StdClass();
         $o->value = 'com_jcomments';
         $o->text = 'com_jcomments';
         $options[] = $o;
     }
     return $options;
 }
Example #3
Show file File: view.html.php Project: proyectoseb/University
0
 function displayEditSettings()
 {
     $item = new StdClass();
     $item->name = 'messageordering';
     $item->label = JText::_('COM_KUNENA_USER_ORDER');
     $options = array();
     $options[] = JHtml::_('select.option', 0, JText::_('COM_KUNENA_USER_ORDER_KUNENA_GLOBAL'));
     $options[] = JHtml::_('select.option', 2, JText::_('COM_KUNENA_USER_ORDER_ASC'));
     $options[] = JHtml::_('select.option', 1, JText::_('COM_KUNENA_USER_ORDER_DESC'));
     $item->field = JHtml::_('select.genericlist', $options, 'messageordering', 'class="kinputbox" size="1"', 'value', 'text', $this->escape($this->profile->ordering), 'kmessageordering');
     $this->settings[] = $item;
     $item = new StdClass();
     $item->name = 'hidemail';
     $item->label = JText::_('COM_KUNENA_USER_HIDEEMAIL');
     $options = array();
     $options[] = JHtml::_('select.option', 0, JText::_('COM_KUNENA_NO'));
     $options[] = JHtml::_('select.option', 1, JText::_('COM_KUNENA_YES'));
     $item->field = JHtml::_('select.genericlist', $options, 'hidemail', 'class="kinputbox" size="1"', 'value', 'text', $this->escape($this->profile->hideEmail), 'khidemail');
     $this->settings[] = $item;
     $item = new StdClass();
     $item->name = 'showonline';
     $item->label = JText::_('COM_KUNENA_USER_SHOWONLINE');
     $options = array();
     $options[] = JHtml::_('select.option', 0, JText::_('COM_KUNENA_NO'));
     $options[] = JHtml::_('select.option', 1, JText::_('COM_KUNENA_YES'));
     $item->field = JHtml::_('select.genericlist', $options, 'showonline', 'class="kinputbox" size="1"', 'value', 'text', $this->escape($this->profile->showOnline), 'kshowonline');
     $this->settings[] = $item;
     $this->row(true);
     echo $this->loadTemplateFile('settings');
 }
Example #4
Show file File: customlabel.class.php Project: SmartPlanetInternational/moodle-mod_customlabel
0
 function __construct($data)
 {
     global $DB;
     parent::__construct($data);
     $this->type = 'worktodo';
     $this->fields = array();
     $this->allowedpageformats = 'page';
     $field = new StdClass();
     $field->name = 'worktodo';
     $field->type = 'textarea';
     $field->rows = 20;
     $this->fields['worktodo'] = $field;
     $field = new StdClass();
     $field->name = 'estimatedworktime';
     $field->type = 'textfield';
     $field->size = 10;
     $this->fields['estimatedworktime'] = $field;
     if ($fieldid = $DB->get_field('customlabel_mtd_type', 'id', array('code' => 'WORKTYPE'))) {
         $field = new StdClass();
         $field->name = 'worktypefield';
         $field->type = 'vdatasource';
         $field->source = 'dbfieldkeyed';
         $field->table = 'customlabel_mtd_value';
         $field->field = 'value';
         $field->key = 'code';
         $field->select = " typeid = {$fieldid} ";
         // $field->multiple = 'multiple';
         $this->fields['worktypefield'] = $field;
     } else {
         // echo "no field for WORKTYPE ";
     }
     if ($fieldid = $DB->get_field('customlabel_mtd_type', 'id', array('code' => 'WORKEFFORT'))) {
         $field = new StdClass();
         $field->name = 'workeffortfield';
         $field->type = 'vdatasource';
         $field->source = 'dbfieldkeyed';
         $field->table = 'customlabel_mtd_value';
         $field->field = 'value';
         $field->key = 'code';
         $field->select = " typeid = {$fieldid} ";
         // $field->multiple = 'multiple';
         $this->fields['workeffortfield'] = $field;
     } else {
         // echo "no field for WORKEFFORT ";
     }
     if ($fieldid = $DB->get_field('customlabel_mtd_type', 'id', array('code' => 'WORKMODE'))) {
         $field = new StdClass();
         $field->name = 'workmodefield';
         $field->type = 'vdatasource';
         $field->source = 'dbfieldkeyed';
         $field->table = 'customlabel_mtd_value';
         $field->field = 'value';
         $field->key = 'code';
         $field->select = " typeid = {$fieldid} ";
         // $field->multiple = 'multiple';
         $this->fields['workmodefield'] = $field;
     } else {
         // echo "no field for WORKMODE ";
     }
 }
Example #5
Show file File: Desif.php Project: arendasistemasintegrados/mateusleme
0
 /**
  * Carrega os Dados das Contas e das Tarifas
  *
  * @param array $aDadosComuns
  * @return bool
  */
 protected function carregarDadosContas(array $aDadosComuns)
 {
     foreach ($aDadosComuns as $iLinha => $sDados) {
         $aDados = explode('|', $sDados);
         if (is_array($aDados)) {
             $iCodigoRegistro = trim($aDados[1]);
             if ($iCodigoRegistro == '0100') {
                 $oDadosConta = new StdClass();
                 $oDadosConta->sConta = trim($aDados[2]);
                 $oDadosConta->sDescricaoConta = trim($aDados[3]);
                 $oDadosConta->sNome = trim($aDados[4]);
                 $oDadosConta->sContaPai = trim($aDados[5]);
                 $oDadosConta->sContaCosif = trim($aDados[6]);
                 $this->aDadosDesifContas[$iLinha] = $oDadosConta;
             } else {
                 if ($iCodigoRegistro == '0200') {
                     $oImportacaoDesifTarifa = new StdClass();
                     $oImportacaoDesifTarifa->sDescricao = trim($aDados[3]);
                     $oImportacaoDesifTarifa->sConta = trim($aDados[4]);
                     $oImportacaoDesifTarifa->sTarifaConta = str_replace(' ', '.', trim($aDados[2]));
                     $this->aDadosDesifTarifas[$iLinha] = $oImportacaoDesifTarifa;
                 }
             }
         }
     }
     return TRUE;
 }
Example #6
Show file File: TStandardSeek.php Project: kiibe/linkERP
0
 /**
  * Select the register by ID and return the information to the main form
  *     When using onblur signal, AJAX passes all needed parameters via GET
  *     instead of calling onSetup before.
  */
 public static function onSelect($param)
 {
     $key = $param['key'];
     $database = isset($param['database']) ? $param['database'] : TSession::getValue('standard_seek_database');
     $receive_key = isset($param['receive_key']) ? $param['receive_key'] : TSession::getValue('standard_seek_receive_key');
     $receive_field = isset($param['receive_field']) ? $param['receive_field'] : TSession::getValue('standard_seek_receive_field');
     $display_field = isset($param['display_field']) ? $param['display_field'] : TSession::getValue('standard_seek_display_field');
     $parent = isset($param['parent']) ? $param['parent'] : TSession::getValue('standard_seek_parent');
     try {
         TTransaction::open($database);
         // load the active record
         $model = isset($param['model']) ? $param['model'] : TSession::getValue('standard_seek_model');
         $activeRecord = new $model($key);
         $pk = constant("{$model}::PRIMARYKEY");
         $object = new StdClass();
         $object->{$receive_key} = isset($activeRecord->{$pk}) ? $activeRecord->{$pk} : '';
         $object->{$receive_field} = isset($activeRecord->{$display_field}) ? $activeRecord->{$display_field} : '';
         TTransaction::close();
         TForm::sendData($parent, $object);
         parent::closeWindow();
         // closes the window
     } catch (Exception $e) {
         // clear fields
         $object = new StdClass();
         $object->{$receive_key} = '';
         $object->{$receive_field} = '';
         TForm::sendData($parent, $object);
         // undo all pending operations
         TTransaction::rollback();
     }
 }
Example #7
Show file File: TStandardSeek.class.php Project: jhonleandres/crmbf
0
 /**
  * Select the register by ID and return the information to the main form
  *     When using onblur signal, AJAX passes all needed parameters via GET
  *     instead of calling onSetup before.
  */
 public function onSelect($param)
 {
     $key = $param['key'];
     $database = isset($param['database']) ? $param['database'] : TSession::getValue('standard_seek_database');
     $receive_key = isset($param['receive_key']) ? $param['receive_key'] : TSession::getValue('standard_seek_receive_key');
     $receive_field = isset($param['receive_field']) ? $param['receive_field'] : TSession::getValue('standard_seek_receive_field');
     $display_field = isset($param['display_field']) ? $param['display_field'] : TSession::getValue('standard_seek_display_field');
     $parent = isset($param['parent']) ? $param['parent'] : TSession::getValue('standard_seek_parent');
     try {
         TTransaction::open($database);
         // load the active record
         $model = isset($param['model']) ? $param['model'] : TSession::getValue('standard_seek_model');
         $activeRecord = new $model($key);
         TTransaction::close();
         $object = new StdClass();
         $object->{$receive_key} = $activeRecord->{'id'};
         $object->{$receive_field} = $activeRecord->{$display_field};
         TForm::sendData($parent, $object);
         parent::closeWindow();
         // closes the window
     } catch (Exception $e) {
         // clear fields
         $object = new StdClass();
         $object->{$receive_key} = '';
         $object->{$receive_field} = '';
         TForm::sendData($parent, $object);
         // undo all pending operations
         TTransaction::rollback();
     }
 }
Example #8
Show file File: requestfriendship.php Project: janaece/globalclassroom4_clean
0
function requestfriendship_submit(Pieform $form, $values)
{
    global $USER, $SESSION, $id, $goto;
    $loggedinid = $USER->get('id');
    $user = get_record('usr', 'id', $id);
    // friend db record
    $f = new StdClass();
    $f->ctime = db_format_timestamp(time());
    // notification info
    $n = new StdClass();
    $n->url = profile_url($USER, false);
    $n->users = array($user->id);
    $n->fromuser = $loggedinid;
    $lang = get_user_language($user->id);
    $displayname = display_name($USER, $user);
    $n->strings = new stdClass();
    $n->strings->urltext = (object) array('key' => 'Requests');
    $f->owner = $id;
    $f->requester = $loggedinid;
    $f->message = $values['message'];
    insert_record('usr_friend_request', $f);
    $n->subject = get_string_from_language($lang, 'requestedfriendlistsubject', 'group');
    if (isset($values['message']) && !empty($values['message'])) {
        $n->message = get_string_from_language($lang, 'requestedfriendlistmessageexplanation', 'group', $displayname) . $values['message'];
    } else {
        $n->message = get_string_from_language($lang, 'requestedfriendlistinboxmessage', 'group', $displayname);
    }
    require_once 'activity.php';
    activity_occurred('maharamessage', $n);
    handle_event('addfriendrequest', array('requester' => $loggedinid, 'owner' => $id));
    $SESSION->add_ok_msg(get_string('friendformrequestsuccess', 'group', display_name($id)));
    redirect($goto);
}
Example #9
Show file File: ExportOdtTest.php Project: akandshuvo/phpmyadmin
0
 /**
  * Test for PMA\libraries\plugins\export\ExportOdt::exportData
  *
  * @return void
  */
 public function testExportData()
 {
     $dbi = $this->getMockBuilder('PMA\\libraries\\DatabaseInterface')->disableOriginalConstructor()->getMock();
     $flags = array();
     $a = new StdClass();
     $flags[] = $a;
     $a = new StdClass();
     $a->blob = true;
     $flags[] = $a;
     $a = new StdClass();
     $a->numeric = true;
     $a->type = 'real';
     $a->blob = false;
     $flags[] = $a;
     $a = new StdClass();
     $a->type = "timestamp";
     $a->blob = false;
     $a->numeric = false;
     $flags[] = $a;
     $dbi->expects($this->once())->method('getFieldsMeta')->with(true)->will($this->returnValue($flags));
     $dbi->expects($this->at(4))->method('fieldFlags')->will($this->returnValue('BINARYTEST'));
     $dbi->expects($this->at(5))->method('fieldFlags')->will($this->returnValue('binary'));
     $dbi->expects($this->once())->method('query')->with('SELECT', null, PMA\libraries\DatabaseInterface::QUERY_UNBUFFERED)->will($this->returnValue(true));
     $dbi->expects($this->once())->method('numFields')->with(true)->will($this->returnValue(4));
     $dbi->expects($this->at(7))->method('fetchRow')->with(true)->will($this->returnValue(array(null, 'a<b', 'a>b', 'a&b')));
     $dbi->expects($this->at(8))->method('fetchRow')->with(true)->will($this->returnValue(null));
     $GLOBALS['dbi'] = $dbi;
     $GLOBALS['what'] = 'foo';
     $GLOBALS['foo_null'] = "&";
     $this->assertTrue($this->object->exportData('db', 'ta<ble', "\n", "example.com", "SELECT"));
     $this->assertEquals('<text:h text:outline-level="2" text:style-name="Heading_2" ' . 'text:is-list-header="true">Dumping data for table ta&lt;ble</text:h>' . '<table:table table:name="ta&lt;ble_structure"><table:table-column ' . 'table:number-columns-repeated="4"/><table:table-row>' . '<table:table-cell office:value-type="string"><text:p>&amp;</text:p>' . '</table:table-cell><table:table-cell office:value-type="string">' . '<text:p></text:p></table:table-cell><table:table-cell ' . 'office:value-type="float" office:value="a>b" ><text:p>a&gt;b</text:p>' . '</table:table-cell><table:table-cell office:value-type="string">' . '<text:p>a&amp;b</text:p></table:table-cell></table:table-row>' . '</table:table>', $GLOBALS['odt_buffer']);
 }
Example #10
Show file File: DeviceTokenListTest.php Project: gopinathshiva/wordpress-vip-plugins
0
 public function testMultiPageList()
 {
     // Stub the two responses
     $listResponse = new StdClass();
     $listResponse->code = 200;
     $listResponse->raw_headers = array();
     $listResponse->raw_body = "{\"device_tokens\": [\"foo\",\"bar\"],\"device_tokens_count\": 2," . "\"active_device_tokens_count\": 3, \"next_page\":\"foo\"}";
     $emptyResponse = new StdClass();
     $emptyResponse->code = 200;
     $emptyResponse->raw_headers = array();
     // Return an empty array
     $emptyResponse->raw_body = "{\"device_tokens\": [\"baz\"],\"device_tokens_count\": 1," . "\"active_device_tokens_count\": 3}";
     // Partial mock for airship, return the mocked response with the
     // prefab device list, setup both calls
     $mockship = $this->getMockBuilder('\\UrbanAirship\\Airship')->setConstructorArgs(array('key', 'secret'))->setMethods(array('request'))->getMock();
     $mockship->expects($this->exactly(2))->method('request')->will($this->onConsecutiveCalls($listResponse, $emptyResponse));
     $list = $mockship->listDeviceTokens();
     $test_array = array();
     foreach ($list as $dt) {
         array_push($test_array, $dt);
     }
     array_key_exists('foo', $test_array);
     array_key_exists('bar', $test_array);
     array_key_exists('baz', $test_array);
 }
Example #11
Show file File: VarDumperTest.php Project: howq/yii2
0
 /**
  * Data provider for [[testExport()]]
  * @return array test data
  */
 public function dataProviderExport()
 {
     // Regular :
     $data = [['test string', var_export('test string', true)], [75, var_export(75, true)], [7.5, var_export(7.5, true)], [null, 'null'], [true, 'true'], [false, 'false'], [[], '[]']];
     // Arrays :
     $var = ['key1' => 'value1', 'key2' => 'value2'];
     $expectedResult = <<<RESULT

 'key1' => 'value1',
 'key2' => 'value2',

ULT;
     $data[] = [$var, $expectedResult];
     $var = ['value1', 'value2'];
     $expectedResult = <<<RESULT

 'value1',
 'value2',

ULT;
     $data[] = [$var, $expectedResult];
     // Objects :
     $var = new \StdClass();
     $var->testField = 'Test Value';
     $expectedResult = "unserialize('" . serialize($var) . "')";
     $data[] = [$var, $expectedResult];
     $var = new \StdClass();
     $var->testFunction = function () {
         return 2;
     };
     $expectedResult = var_export($var, true);
     $data[] = [$var, $expectedResult];
     return $data;
 }
Example #12
Show file File: BuscaTipoContato.class.php Project: edurbs/sobcontrole
0
 /**
  * Executed when the user chooses the record
  */
 public function onSelect($param)
 {
     try {
         $key = $param['key'];
         TTransaction::open('sobcontrole');
         // load the active record
         $tipocontato = new tipocontato($key);
         //var_dump($tipocontato);
         // closes the transaction
         TTransaction::close();
         $object = new StdClass();
         $object->tipocontato_idtipocontato = $tipocontato->idtipocontato;
         $object->tipocontato_descricao = $tipocontato->descricao;
         TForm::sendData('form_seek_sample', $object);
         parent::closeWindow();
         // closes the window
     } catch (Exception $e) {
         // clear fields
         $object = new StdClass();
         $object->tipocontato_idtipocontato = '';
         $object->tipocontato_descricao = '';
         TForm::sendData('form_seek_sample', $object);
         // undo pending operations
         TTransaction::rollback();
     }
 }
Example #13
Show file File: RegistroFormSeek.class.php Project: jhonleandres/crmbf
0
 /**
  * Executed when the user chooses the record
  */
 function onSelect($param)
 {
     try {
         $key = $param['key'];
         TTransaction::open('samples');
         // load the active record
         $city = new City($key);
         // closes the transaction
         TTransaction::close();
         $object = new StdClass();
         $object->city_id1 = $city->id;
         $object->city_name1 = $city->name;
         TForm::sendData('form_seek_sample', $object);
         parent::closeWindow();
         // closes the window
     } catch (Exception $e) {
         // em caso de exceção
         // clear fields
         $object = new StdClass();
         $object->city_id1 = '';
         $object->city_name1 = '';
         TForm::sendData('form_seek_sample', $object);
         // undo pending operations
         TTransaction::rollback();
     }
 }
Example #14
Show file File: TestCitySeek.class.php Project: jhonleandres/Atividades
0
 /**
  * Executed when the user chooses the record
  */
 function onSelect($param)
 {
     try {
         $key = $param['key'];
         TTransaction::open('tecbiz');
         // load the active record
         $pessoa = new Pessoa($key);
         // closes the transaction
         TTransaction::close();
         $object = new StdClass();
         $object->city_id1 = $pessoa->pessoa_codigo;
         $object->city_name1 = $pessoa->pessoa_nome;
         TForm::sendData('form_seek_sample', $object);
         parent::closeWindow();
         // closes the window
     } catch (Exception $e) {
         // clear fields
         $object = new StdClass();
         $object->city_id1 = '';
         $object->city_name1 = '';
         TForm::sendData('form_seek_sample', $object);
         // undo pending operations
         TTransaction::rollback();
     }
 }
Example #15
Show file File: submit_rpc_handler.php Project: CalvinZhu/boinc
0
function xml_get_jobs($r)
{
    $jobs = array();
    foreach ($r->batch->job as $j) {
        $job = new StdClass();
        $job->input_files = array();
        $job->command_line = (string) $j->command_line;
        $job->target_team = (int) $j->target_team;
        $job->target_user = (int) $j->target_user;
        $job->target_host = (int) $j->target_host;
        $job->name = (string) $j->name;
        $job->rsc_fpops_est = (double) $j->rsc_fpops_est;
        foreach ($j->input_file as $f) {
            $file = new StdClass();
            $file->mode = (string) $f->mode;
            if ($file->mode == "remote") {
                $file->url = (string) $f->url;
                $file->nbytes = (double) $f->nbytes;
                $file->md5 = (string) $f->md5;
            } else {
                $file->source = (string) $f->source;
            }
            $job->input_files[] = $file;
        }
        $jobs[] = $job;
    }
    return $jobs;
}
Example #16
Show file File: AdminController.php Project: tldmic/admin_demo
0
 public function getIndex()
 {
     $contactsWithoutCompaniesCount = Contact::withoutCompanies()->count();
     $contactsByCountries = [];
     $rows = Country::with('contacts')->get();
     foreach ($rows as $row) {
         $obj = new StdClass();
         $obj->label = $row->title;
         $obj->value = $row->contacts->count();
         $contactsByCountries[] = $obj;
     }
     $contactsByCompanies = [];
     $rows = Company::with('contacts')->get();
     foreach ($rows as $row) {
         $obj = new StdClass();
         $obj->label = $row->title;
         $obj->value = $row->contacts->count();
         $contactsByCompanies[] = $obj;
     }
     $contactsCount = Contact::count();
     $companiesCount = Company::count();
     $countriesCount = Country::count();
     $data = compact('contactsWithoutCompaniesCount', 'contactsByCompanies', 'contactsByCountries', 'contactsCount', 'companiesCount', 'countriesCount');
     return View::make('admin.index', $data);
 }
Example #17
Show file File: customlabel.class.php Project: SmartPlanetInternational/moodle-mod_customlabel
0
 function __construct($data)
 {
     parent::__construct($data);
     $this->type = 'definition';
     $this->fields = array();
     $field = new StdClass();
     $field->name = 'definition';
     $field->type = 'textarea';
     $field->rows = 20;
     $this->fields['definition'] = $field;
     if (!isset($data->subdefsnum)) {
         // second chance, get it from stored data
         $storeddata = json_decode(base64_decode(@$this->data->content));
         $subdefsnum = !empty($storeddata->subdefsnum) ? $storeddata->subdefsnum : 0;
     } else {
         $subdefsnum = $data->subdefsnum;
     }
     $field = new StdClass();
     $field->name = 'subdefsnum';
     $field->type = 'list';
     $field->options = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10');
     $field->straightoptions = true;
     $this->fields['subdefsnum'] = $field;
     for ($i = 0; $i < $subdefsnum; $i++) {
         $field = new StdClass();
         $field->name = 'subdef' . $i;
         $field->type = 'textarea';
         $field->size = 60;
         $this->fields['subdef' . $i] = $field;
     }
 }
Example #18
Show file File: SettingsController.php Project: noikiy/Xenon-Support-Center
0
 public function all()
 {
     $raw_settings = Settings::all();
     $settings = new StdClass();
     foreach ($raw_settings as $raw_setting) {
         $settings->{$raw_setting->key} = json_decode($raw_setting->value);
     }
     $smtp = new StdClass();
     $smtp->from_address = Config::get('mail.from.address') == null ? '' : Config::get('mail.from.address');
     $smtp->from_name = Config::get('mail.from.name') == null ? '' : Config::get('mail.from.name');
     $smtp->reply_to_address = Config::get('mail.reply-to.address') == null ? '' : Config::get('mail.reply-to.address');
     $smtp->reply_to_name = Config::get('mail.reply-to.name') == null ? '' : Config::get('mail.reply-to.name');
     $smtp->host = Config::get('mail.host') == null ? '' : Config::get('mail.host');
     $smtp->username = Config::get('mail.username') == null ? '' : Config::get('mail.username');
     $smtp->password = Config::get('mail.password') == null ? '' : Config::get('mail.password');
     $mailgun = new StdClass();
     $mailgun->from_address = Config::get('mail.from.address') == null ? '' : Config::get('mail.from.address');
     $mailgun->from_name = Config::get('mail.from.name') == null ? '' : Config::get('mail.from.name');
     $mailgun->reply_to = Config::get('mail.reply-to.address') == null ? '' : Config::get('mail.reply-to.address');
     $mailgun->api_key = Config::get('services.mailgun.secret') == null ? '' : Config::get('services.mailgun.secret');
     $mailgun->domain = Config::get('mail.host') == null ? '' : Config::get('mail.host');
     $mailgun->use_mailgun = Config::get('mail.use_mailgun');
     $settings->smtp = $smtp;
     $settings->mailgun = $mailgun;
     $this->data['settings'] = $settings;
     return View::make('settings', $this->data);
 }
Example #19
Show file File: TicketPessoaSeek.class.php Project: jhonleandres/Atividades
0
 /**
  * Executed when the user chooses the record
  */
 function onSelect($param)
 {
     try {
         $key = $param['key'];
         TTransaction::open('atividade');
         // load the active record
         $pessoa = new Pessoa($key);
         $object = new StdClass();
         $object->solicitante_id = $pessoa->pessoa_codigo;
         $object->solicitante_nome = $pessoa->pessoa_nome;
         $object->origem_nome = $pessoa->origem_nome;
         // closes the transaction
         TTransaction::close();
         TForm::sendData('form_Ticket', $object);
         parent::closeWindow();
         // closes the window
     } catch (Exception $e) {
         // clear fields
         $object = new StdClass();
         $object->solicitante_id = '';
         $object->solicitante_nome = '';
         $object->origem_nome = '';
         TForm::sendData('form_Ticket', $object);
         // undo pending operations
         TTransaction::rollback();
     }
 }
Example #20
Show file File: ItemSeek.class.php Project: jhonleandres/crmbf
0
 /**
  * Executed when the user chooses the record
  */
 public function onSelect($param)
 {
     try {
         $key = $param['key'];
         TTransaction::open('library');
         // load the active record
         $rep = new TRepository('Item');
         $criteria = new TCriteria();
         $criteria->add(new TFilter('barcode', '=', $key));
         $objects = $rep->load($criteria);
         if ($objects) {
             $item = $objects[0];
             $object = new StdClass();
             $object->barcode_input = $item->barcode;
             $object->book_title_input = $item->title;
             TForm::sendData('form_Loan', $object);
         } else {
             $object = new StdClass();
             $object->barcode_input = '';
             $object->book_title_input = '';
             TForm::sendData('form_Loan', $object);
         }
         // closes the transaction
         TTransaction::close();
         parent::closeWindow();
         // closes the window
     } catch (Exception $e) {
         // exibe a mensagem gerada pela exceção
         new TMessage('error', $e->getMessage());
         // desfaz todas alterações no banco de dados
         TTransaction::rollback();
     }
 }