Example #1
0
 public static function sendNotification($c, $projects, $send_to, $sf_user)
 {
     foreach ($send_to as $type => $users) {
         switch ($type) {
             case 'status':
                 $subject = t::__('Project Status Updated');
                 break;
             default:
                 $subject = t::__('New Project');
                 break;
         }
         $to = array();
         foreach ($users as $v) {
             if ($u = Doctrine_Core::getTable('Users')->find($v)) {
                 $to[$u->getEmail()] = $u->getName();
             }
         }
         $user = $sf_user->getAttribute('user');
         $from[$user->getEmail()] = $user->getName();
         $to[$projects->getUsers()->getEmail()] = $projects->getUsers()->getName();
         $to[$user->getEmail()] = $user->getName();
         if (sfConfig::get('app_send_email_to_owner') == 'off') {
             unset($to[$user->getEmail()]);
         }
         $subject .= ': ' . $projects->getName() . ($projects->getProjectsStatusId() > 0 ? ' [' . $projects->getProjectsStatus()->getName() . ']' : '');
         $body = $c->getComponent('projects', 'emailBody', array('projects' => $projects));
         Users::sendEmail($from, $to, $subject, $body, $sf_user);
     }
 }
Example #2
0
 public static function getPublicStatusList()
 {
     $list = array();
     $list[1] = t::__('Use for public tickets');
     $list[2] = t::__('Only for public tickets');
     $list[3] = t::__('Don\'t use for public tickets');
     return $list;
 }
Example #3
0
 public function executeDelete(sfWebRequest $request)
 {
     $this->forward404Unless($this->users_groups = Doctrine_Core::getTable('UsersGroups')->find(array($request->getParameter('id'))), sprintf('Object users_groups does not exist (%s).', $request->getParameter('id')));
     $this->count_users = UsersGroups::countUsersByGroupId($request->getParameter('id'));
     if ($request->isMethod(sfRequest::PUT) and $this->count_users == 0) {
         $this->users_groups->delete();
         $this->getUser()->setFlash('userNotices', t::__('User Group Deleted'));
         $this->redirect('usersGroups/index');
     }
 }
Example #4
0
function main()
{
    $b = new b();
    $b->f($b);
    t::f($b);
    $b->set($b, 'new value');
    t::set($b, 'newer value');
    $a = new a();
    $a->f($a);
    t::f($a);
}
Example #5
0
 public function configure()
 {
     $project_access_choices = array('1' => t::__('Full Access'), '2' => t::__('View Only'), '3' => t::__('View Own Only'), '4' => t::__('Manage Own Only'));
     $default_choices = array('' => t::__('None'), '1' => t::__('Full Access'), '2' => t::__('View Only'), '3' => t::__('View Own Only'), '4' => t::__('Manage Own Only'));
     $this->widgetSchema['allow_manage_projects'] = new sfWidgetFormChoice(array('choices' => $project_access_choices));
     $this->widgetSchema['allow_manage_tasks'] = new sfWidgetFormChoice(array('choices' => $default_choices));
     $this->widgetSchema['allow_manage_tickets'] = new sfWidgetFormChoice(array('choices' => $default_choices));
     $this->widgetSchema['allow_manage_discussions'] = new sfWidgetFormChoice(array('choices' => $default_choices));
     $this->widgetSchema['allow_manage_users'] = new sfWidgetFormInputCheckbox(array(), array('value' => 1));
     $this->widgetSchema['allow_manage_configuration'] = new sfWidgetFormInputCheckbox(array(), array('value' => 1));
     $this->widgetSchema['name']->setAttribute('class', 'required');
     $this->widgetSchema->setLabels(array('allow_manage_projects' => 'Projects', 'allow_manage_tasks' => 'Tasks', 'allow_manage_tickets' => 'Tickets', 'allow_manage_discussions' => 'Discussions', 'allow_manage_configuration' => 'Configuration', 'allow_manage_users' => 'Users'));
 }
Example #6
0
 protected function getMoreActions(sfWebRequest $request)
 {
     $more_actions = array();
     $s = array();
     if (Users::hasAccess('edit', 'tasks', $this->getUser(), $request->getParameter('projects_id'))) {
         $s[] = array('title' => t::__('Move To'), 'url' => 'tasks/moveTo?tasks_id=' . $request->getParameter('tasks_id') . '&projects_id=' . $request->getParameter('projects_id') . '&redirect_to=tasksComments', 'modalbox' => true);
     }
     if (Users::hasAccess('delete', 'tasks', $this->getUser(), $request->getParameter('projects_id'))) {
         $s[] = array('title' => t::__('Delete'), 'url' => 'tasks/delete?id=' . $request->getParameter('tasks_id') . '&projects_id=' . $request->getParameter('projects_id'), 'confirm' => true);
     }
     if (count($s) > 0) {
         $more_actions[] = array('title' => t::__('More Actions'), 'submenu' => $s);
     }
     return $more_actions;
 }
Example #7
0
 public static function getTypesChoices()
 {
     $l = array();
     $l['text'] = t::__('Input Field');
     $l['number'] = t::__('Input Numeric Field');
     $l['url'] = t::__('Input URL Field');
     $l['file'] = t::__('File');
     $l['textarea'] = t::__('Textarea');
     $l['textarea_wysiwyg'] = t::__('Textarea with WYSIWYG editor');
     $l['date_dropdown'] = t::__('Date');
     $l['date'] = t::__('Date with calendar picker');
     $l['date_time'] = t::__('Date with calendar and time picker');
     $l['date_range'] = t::__('Date range with calendar picker');
     return $l;
 }
Example #8
0
 public static function renderJsDictionary()
 {
     $messages = array();
     $messages[] = "Loading...";
     $messages[] = "Are you sure?";
     $messages[] = "Please Select Items";
     $messages[] = "Format";
     $messages[] = "Day";
     $messages[] = "Week";
     $messages[] = "Month";
     $messages[] = "Quarter";
     $messages[] = "Status";
     $messages[] = "Duration";
     $messages[] = "Progress";
     $messages[] = "Start Date";
     $messages[] = "Due Date";
     $messages[] = "Bold";
     $messages[] = "Italic";
     $messages[] = "Underline";
     $messages[] = "Left Align";
     $messages[] = "Numbered List";
     $messages[] = "Bulleted List";
     $messages[] = "Indent More";
     $messages[] = "Indent Less";
     $messages[] = "Strike";
     $messages[] = "Remove Formatting";
     $messages[] = "Horizontal Rule";
     $messages[] = "Image";
     $messages[] = "Text Color";
     $messages[] = "Background Color";
     $messages[] = "Source";
     $messages[] = "Code";
     $messages[] = "Quote";
     $messages[] = "Paragraph";
     $content = '
 <script type="text/javascript">
   var I18NJSText = new Array()';
     foreach ($messages as $value) {
         $content .= "\n      I18NJSText['" . addslashes($value) . "']='" . addslashes(t::__($value)) . "';\n";
     }
     $content .= "</script>\n";
     return $content;
 }
Example #9
0
 public static function sendNotification($c, $comment, $sf_user)
 {
     $user = $sf_user->getAttribute('user');
     $from = array($user->getEmail() => $user->getName());
     $to = array();
     $to[$user->getEmail()] = $user->getName();
     if ($departments = Doctrine_Core::getTable('Departments')->find($comment->getTickets()->getDepartmentsId())) {
         $to[$departments->getUsers()->getEmail()] = $departments->getUsers()->getName();
     }
     $to[$comment->getTickets()->getUsers()->getEmail()] = $comment->getTickets()->getUsers()->getName();
     $tickets_comments = Doctrine_Core::getTable('TicketsComments')->createQuery()->addWhere('tickets_id=?', $comment->getTicketsId())->orderBy('created_at desc')->execute();
     foreach ($tickets_comments as $v) {
         $to[$v->getUsers()->getEmail()] = $v->getUsers()->getName();
     }
     if (sfConfig::get('app_send_email_to_owner') == 'off') {
         unset($to[$user->getEmail()]);
     }
     $subject = t::__('New Ticket Comment') . ': ' . $comment->getTickets()->getProjects()->getName() . ' - ' . $comment->getTickets()->getName() . ($comment->getTickets()->getTicketsStatusId() > 0 ? ' [' . $comment->getTickets()->getTicketsStatus()->getName() . ']' : '');
     $body = $c->getComponent('ticketsComments', 'emailBody', array('tickets' => $comment->getTickets()));
     Users::sendEmail($from, $to, $subject, $body, $sf_user);
 }
Example #10
0
 public function executeIndex(sfWebRequest $request)
 {
     if ($request->hasParameter('delete_logo')) {
         if (is_file(sfConfig::get('sf_upload_dir') . '/' . sfConfig::get('app_app_logo'))) {
             unlink(sfConfig::get('sf_upload_dir') . '/' . sfConfig::get('app_app_logo'));
         }
     }
     if ($request->hasParameter('cfg')) {
         $cfg = $request->getParameter('cfg');
         foreach ($cfg as $key => $value) {
             $configuration = Doctrine_Core::getTable('Configuration')->createQuery('c')->addWhere('c.key = ?', $key)->fetchOne();
             if (is_array($value)) {
                 $value = implode(',', $value);
             }
             if ($key == 'app_app_logo') {
                 $file = $request->getFiles();
                 if (strlen($file['cfg_app_app_logo_file']['name']) > 0) {
                     if (getimagesize($file['cfg_app_app_logo_file']['tmp_name'])) {
                         move_uploaded_file($file['cfg_app_app_logo_file']['tmp_name'], sfConfig::get('sf_upload_dir') . '/' . $file['cfg_app_app_logo_file']['name']);
                         $value = $file['cfg_app_app_logo_file']['name'];
                     }
                 }
             }
             if ($configuration) {
                 $configuration->setValue($value);
                 $configuration->save();
             } else {
                 $sql = "INSERT INTO configuration (configuration.key, configuration.value) VALUES ('" . $key . "', '" . $value . "')";
                 $connection = Doctrine_Manager::connection();
                 $connection->execute($sql);
             }
         }
         $this->getUser()->setFlash('userNotices', t::__('Configuration has been successfully updated'));
         $this->redirect('configuration/index?type=' . $request->getParameter('type'));
     }
     app::setPageTitle('Configuration', $this->getResponse());
 }
Example #11
0
 public static function sendNotification($c, $comment, $sf_user)
 {
     $to = array();
     foreach (explode(',', $comment->getDiscussions()->getAssignedTo()) as $v) {
         if ($u = Doctrine_Core::getTable('Users')->find($v)) {
             $to[$u->getEmail()] = $u->getName();
         }
     }
     $user = $sf_user->getAttribute('user');
     $from[$user->getEmail()] = $user->getName();
     $to[$comment->getDiscussions()->getUsers()->getEmail()] = $comment->getDiscussions()->getUsers()->getName();
     $to[$user->getEmail()] = $user->getName();
     $discussions_comments = Doctrine_Core::getTable('DiscussionsComments')->createQuery()->addWhere('discussions_id=?', $comment->getDiscussionsId())->orderBy('created_at desc')->execute();
     foreach ($discussions_comments as $v) {
         $to[$v->getUsers()->getEmail()] = $v->getUsers()->getName();
     }
     if (sfConfig::get('app_send_email_to_owner') == 'off') {
         unset($to[$user->getEmail()]);
     }
     $to = array_unique($to);
     $subject = t::__('New Discussion Comment') . ': ' . $comment->getDiscussions()->getProjects()->getName() . ' - ' . $comment->getDiscussions()->getName() . ($comment->getDiscussions()->getDiscussionsStatusId() > 0 ? ' [' . $comment->getDiscussions()->getDiscussionsStatus()->getName() . ']' : '');
     $body = $c->getComponent('discussionsComments', 'emailBody', array('discussions' => $comment->getDiscussions()));
     Users::sendEmail($from, $to, $subject, $body, $sf_user);
 }
Example #12
0
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $files = $request->getFiles();
     $userPhoto = $files['users']['photo']['name'];
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $user = $this->getUser()->getAttribute('user');
         $this->checkUser($form['email']->getValue(), $user->getId());
         $form->setFieldValue('users_group_id', $user->getUsersGroupId());
         $form->setFieldValue('active', $user->getActive());
         if (isset($form['new_password'])) {
             if (strlen($form['new_password']->getValue()) > 0) {
                 $form->setFieldValue('password', md5($form['new_password']->getValue()));
             }
         }
         if (strlen($userPhoto) > 0) {
             $userPhoto = rand(111111, 999999) . '-' . $userPhoto;
             $filename = sfConfig::get('sf_upload_dir') . '/users/' . $userPhoto;
             move_uploaded_file($files['users']['photo']['tmp_name'], $filename);
             $form->setFieldValue('photo', $userPhoto);
             app::image_resize($filename, $filename);
         } else {
             $form->setFieldValue('photo', $form['photo_preview']->getValue());
         }
         if ($form['remove_photo']->getValue() == 1 && strlen($form['photo_preview']->getValue()) > 0) {
             unlink(sfConfig::get('sf_upload_dir') . '/users/' . $form['photo_preview']->getValue());
             $form->setFieldValue('photo', '');
         }
         $users = $form->save();
         $this->getUser()->setAttribute('user', $users);
         $this->getUser()->setCulture($users->getCulture());
         ExtraFieldsList::setValues($request->getParameter('extra_fields'), $users->getId(), 'users', $this->getUser());
         $this->getUser()->setFlash('userNotices', t::__('Account Updated'));
         $this->redirect('myAccount/index');
     }
 }
Example #13
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $this->skins_list = array();
     $skinsDir = sfConfig::get('sf_web_dir') . '/css/skins/';
     if ($handle = opendir($skinsDir)) {
         while (false !== ($file = readdir($handle))) {
             if ($file != "." && $file != ".." && is_dir($skinsDir . $file)) {
                 $this->skins_list[] = $file;
             }
         }
     }
     if ($request->hasParameter('setSkin')) {
         $setSkin = $request->getParameter('setSkin');
         if (is_file(sfConfig::get('sf_web_dir') . '/css/skins/' . $setSkin . '/styles.css')) {
             $this->getResponse()->setCookie('skin', $setSkin, time() + 31536000, '', '');
             $users = Doctrine_Core::getTable('Users')->find($this->getUser()->getAttribute('id'));
             $users->setSkin($setSkin);
             $users->save();
         } else {
             $this->getUser()->setFlash('userNotices', array('type' => 'error', 'text' => t::__('Skin style is not found. Please check next path:') . '/css/skins/' . $setSkin . '/styles.css'));
         }
         $this->redirect('dashboard/index');
     }
 }
Example #14
0
g.setFormatArr("day","week","month","quarter") // Set format options (up to 4 : "minute","hour","day","week","month","quarter")

<?php 
$taskProjectId = 0;
$parentItemId = 0;
$counter = 1;
foreach ($tasks_list as $tasks) {
    if ($tasks['projects_id'] != $taskProjectId) {
        $taskProjectId = $tasks['projects_id'];
        echo "g.AddTaskItem(new JSGantt.TaskItem(" . $counter . ", '" . addslashes($tasks['Projects']['name']) . "','','','ffe763', '" . url_for('ganttChart/index?projects_id=' . $tasks['projects_id']) . "','','',0,1,0," . $pOpen . ",'','" . url_for('projects/info?id=' . $tasks['projects_id']) . "')); \n";
        $parentItemId = $counter;
        $counter++;
    }
    $estimated_time = $tasks['estimated_time'];
    if ($estimated_time > 0) {
        $estimated_title = $estimated_time . ' ' . t::__('hours');
    } else {
        $estimated_title = '';
    }
    $start_date = app::ganttDateFormat($tasks['start_date']);
    $end_date = app::ganttDateFormat($tasks['due_date']);
    $level_padding = '';
    if (count($tasks_tree) > 0) {
        if ($tasks_tree[$tasks['id']]['level'] > 0) {
            $level_padding = str_repeat('&nbsp;-&nbsp;', $tasks_tree[$tasks['id']]['level']);
        }
    }
    echo "g.AddTaskItem(new JSGantt.TaskItem(" . $counter . ", '" . $level_padding . addslashes($tasks['name']) . "','" . $start_date . "','" . $end_date . "','ffe763', '" . url_for('tasksComments/index?tasks_id=' . $tasks['id'] . '&projects_id=' . $tasks['projects_id']) . "','','" . ($tasks['tasks_status_id'] > 0 ? addslashes($tasks['TasksStatus']['name']) : '') . "'," . (int) $tasks['progress'] . ",0," . $parentItemId . ",'','','" . url_for('tasks/info?id=' . $tasks['id'] . '&projects_id=' . $tasks['projects_id']) . "')); \n";
    $counter++;
}
?>
Example #15
0
function main()
{
    $o = new c();
    c::f($o);
    t::f($o);
}
Example #16
0
 public function executeSendEmail(sfWebRequest $request)
 {
     $this->user = $this->getUser()->getAttribute('user');
     if ($request->isMethod(sfRequest::PUT)) {
         if ($request->hasParameter('users_groups')) {
             foreach ($request->getParameter('users_groups') as $id) {
                 $choices = Users::getEmailChoicesByGroupId($id);
                 foreach ($choices as $email => $name) {
                     $from = array($this->user->getEmail() => $this->user->getName());
                     $to = array($email => $name);
                     $subject = $request->getParameter('subject');
                     $body = $request->getParameter('message');
                     Users::sendEmail($from, $to, $subject, $body, $this->getUser(), false);
                 }
             }
             $this->getUser()->setFlash('userNotices', t::__('Message Sent'));
             $this->redirect('users/sendEmail');
         } else {
             $this->getUser()->setFlash('userNotices', array('text' => t::__('User Group is not selected'), 'type' => 'error'));
         }
     }
 }
Example #17
0
echo javascript_include_tag('helpers/jquery.htmlClean.min.js');
?>

    <?php 
if (is_file('js/texteditor/ckeditor.js')) {
    echo javascript_include_tag('texteditor/ckeditor.js');
}
?>
    
    <?php 
echo javascript_include_tag('detectmobilebrowser.js');
?>
        
    
    <?php 
echo t::renderJsDictionary();
?>

    <link rel="shortcut icon" href="<?php 
echo public_path('favicon.ico');
?>
" />
    <link rel="apple-touch-icon" href="<?php 
echo public_path('favicon.png');
?>
" />
  </head>
  <body class="yui-skin-sam" id="yahoo-com">
    
    <div id="pageContainer">
      <div id="page">
Example #18
0
<?php

include '../bootstrap.php';
$config = array('host' => 'localhost', 'user' => 'root', 'password' => 'ghjrcbvf', 'schema' => 'test', 'charset' => 'utf8', 'fetch' => MYSQL_ASSOC);
$db = FireKit\Factories\DataProviderFactory::createProvider('MYSQL', $config);
$db->Connect();
class t extends FireKit\Database\Model\ModelTable
{
    protected $table = array('name' => 'ttt', 'structure' => array("id" => array("type" => "bigint", "options" => array("not null", "auto_increment"), "key" => "primary", "comment" => "rowid"), "crdate" => array("type" => "timestamp", "default" => "CURRENT_TIMESTAMP", "options" => array("not null")), "value" => array("type" => "varchar", "size" => "100", "comment" => "тестовое поле, текстовое"), "ttt" => array("type" => "bigint")), 'indexes' => array("PK" => array("fields" => array("id")), "UK" => array(array("name" => "ttt_name_ui", "fields" => array("crdate")))), "options" => array("engine" => "MyISAM", "charset" => "utf8", "collate" => "utf8_general_ci"));
}
$m = new t($db);
echo $m->UpdateObject($m->GetObject()) . "\n";
$db->Disconnect();
Example #19
0
 public function executeMultipleEdit(sfWebRequest $request)
 {
     if ($request->getParameter('projects_id') > 0) {
         $this->forward404Unless($this->projects = Doctrine_Core::getTable('Projects')->createQuery()->addWhere('id=?', $request->getParameter('projects_id'))->fetchOne(), sprintf('Object projects does not exist (%s).', $request->getParameter('projects_id')));
         $this->checkProjectsAccess($this->projects);
         $this->checkTicketsAccess('edit', false, $this->projects);
     } else {
         $this->checkTicketsAccess('edit');
     }
     $this->fields = array();
     if ($request->getParameter('projects_id') > 0) {
         $this->fields['departments_id'] = array('title' => t::__('Department'), 'choices' => app::getItemsChoicesByTable('Departments', true));
     }
     $choices = app::getItemsChoicesByTable('TicketsStatus', true);
     if (count($choices) > 1) {
         $this->fields['tickets_status_id'] = array('title' => t::__('Status'), 'choices' => $choices);
     }
     $choices = app::getItemsChoicesByTable('TicketsTypes', true);
     if (count($choices) > 1) {
         $this->fields['tickets_types_id'] = array('title' => t::__('Type'), 'choices' => $choices);
     }
     if ($request->getParameter('fields')) {
         if (strlen($request->getParameter('selected_items') == 0)) {
             exit;
         }
         foreach ($request->getParameter('fields') as $key => $value) {
             if (strlen($value) == 0 and !is_array($value)) {
                 continue;
             }
             if ($key == 'tickets_status_id') {
                 foreach (explode(',', $request->getParameter('selected_items')) as $pid) {
                     if ($p = Doctrine_Core::getTable('Tickets')->find($pid)) {
                         if ($p->getTicketsStatusId() != $value) {
                             $p->setTicketsStatusId($value);
                             $p->save();
                             if ($p->getDepartmentsId() > 0) {
                                 Tickets::sendNotification($this, $p, array('status' => explode(',', $p->getDepartments()->getUsersId())), $this->getUser());
                             }
                             $c = new TicketsComments();
                             $c->setTicketsStatusId($value);
                             $c->setTicketsId($pid);
                             $c->setCreatedAt(date('Y-m-d H:i:s'));
                             $c->setUsersId($this->getUser()->getAttribute('id'));
                             $c->save();
                         }
                     }
                 }
             } elseif ($key == 'departments_id') {
                 foreach (explode(',', $request->getParameter('selected_items')) as $pid) {
                     if ($p = Doctrine_Core::getTable('Tickets')->find($pid)) {
                         if ($p->getDepartmentsId() != $value) {
                             $p->setDepartmentsId($value);
                             $p->save();
                             if ($p->getDepartmentsId() > 0) {
                                 Tickets::sendNotification($this, $p, array('new' => explode(',', $p->getDepartments()->getUsersId())), $this->getUser());
                             }
                         }
                     }
                 }
             } else {
                 Doctrine_Query::create()->update('Tickets')->set($key, $value)->whereIn('id', explode(',', $request->getParameter('selected_items')))->execute();
             }
         }
         $this->redirect_to($request->getParameter('redirect_to'), $request->getParameter('projects_id'), $request->getParameter('tickets_id'));
     }
 }
Example #20
0
 public function executeLdap(sfWebRequest $request)
 {
     $this->form = new LdapLoginForm();
     if ($request->isMethod('post')) {
         $this->form->bind($request->getParameter($this->form->getName()));
         if ($this->form->isValid()) {
             $ldap = new ldapLogin();
             $user_attr = $ldap->doLdapLogin($this->form['user']->getValue(), $this->form['password']->getValue());
             if ($user_attr['status'] == true) {
                 $userName = $this->form['user']->getValue();
                 $userEmail = $this->form['user']->getValue() . '@localhost.com';
                 if (strlen($user_attr['email']) > 0) {
                     $userEmail = $user_attr['email'];
                 }
                 if (strlen($user_attr['name']) > 0) {
                     $userName = $user_attr['name'];
                 }
                 $q = Doctrine_Core::getTable('Users')->createQuery()->addWhere('email=?', $userEmail);
                 if (!($user = $q->fetchOne())) {
                     $user = new Users();
                     $user->setUsersGroupId(sfConfig::get('app_ldap_default_user_group'));
                     $user->setName($userName);
                     $user->setEmail($userEmail);
                     $user->setPassword(md5($this->form['password']->getValue()));
                     $user->setActive(1);
                     $user->setCulture(sfConfig::get('sf_default_culture'));
                     $user->save();
                 } else {
                     if ($user->getActive() != 1) {
                         $this->getUser()->setFlash('userNotices', I18NText::__('Your account is not active'));
                         $this->redirect('login/ldap');
                     }
                 }
                 $this->doUserLogin($user, $request);
             } else {
                 $this->getUser()->setFlash('userNotices', t::__($user_attr['msg']));
                 $this->redirect('login/ldap');
             }
         }
     }
     app::setPageTitle('LDAP Login', $this->getResponse());
 }
Example #21
0
 public function testGetEnglishTranslation()
 {
     t::setLanguage('en');
     $this->assertEquals('Username', T::get('user.username'));
     $this->assertEquals('Password', T::get('user.password'));
 }
Example #22
0
<?php

include_once 'common.inc.php';
t::clearAll();
$count = 100;
$data = range(0, $count);
t::i(null, "Control Thread START");
$test = new MapReduce();
$test->setSize(10);
$test->setMaxThread(100);
$test->passPhraseToChild(true);
$test->setData($data);
$test->setMapperName("data");
$test->setPhraseName("INIT_SUM");
$test->clearReducer();
$test->clearDefaultReducer();
$test->addDefaultReducer("http://cto.gcgchina.com/t/sample.child.php");
$test->addReducer(1, "http://cto.gcgchina.com/t/sample.child.php");
$result = $test->execute(1);
print_r($result);
$test->setData(range(0, $result['result'][0]));
$test->setMapperName("data");
$test->setPhraseName("SUM_SUM");
$test->clearReducer();
$test->clearDefaultReducer();
$test->addDefaultReducer("http://cto.gcgchina.com/t/sample.child.php");
$test->addReducer(2, "http://cto.gcgchina.com/t/sample.child.php");
$result = $test->execute(1);
t::i(null, "Control Thread END");
print_r($result);
Example #23
0
 public static function renderFieldValueByType($f, $values, $extra_values = array(), $is_export = false)
 {
     $value = isset($values[$f['id']]) ? $values[$f['id']] : '';
     switch ($f['type']) {
         case 'file':
             $html = '';
             if ($a = Doctrine_Core::getTable('Attachments')->find($value)) {
                 if ($is_export) {
                     return app::public_url('attachments/download?id=' . $a->getId());
                 } else {
                     $html = Attachments::getLink($a);
                 }
             }
             return $html;
             break;
         case 'date_dropdown':
             return strlen($value) > 2 ? app::dateFormat($value, 0, $is_export ? false : true) : '';
             break;
         case 'date':
             return app::dateFormat($value, 0, $is_export ? false : true);
             break;
         case 'date_time':
             return app::dateTimeFormat($value, 0, $is_export ? false : true);
             break;
         case 'date_range':
             if (strlen($value) > 1) {
                 $value = explode('|', $value);
                 return app::dateFormat($value[0], 0, $is_export ? false : true) . ' - ' . app::dateFormat($value[1], 0, $is_export ? false : true);
             } else {
                 return '';
             }
             break;
         case 'formula':
             $formula = $f['default_values'];
             foreach ($values as $k => $v) {
                 $formula = str_replace('[' . $k . ']', (double) $v, $formula);
             }
             foreach ($extra_values as $k => $v) {
                 $formula = str_replace('[' . $k . ']', (double) $v, $formula);
             }
             if (!strstr($formula, '[')) {
                 if (strstr($formula, '{')) {
                     $eval_str = 'function getFormulaValue()' . $formula . '; $fv=getFormulaValue();';
                 } else {
                     $eval_str = '$fv=' . $formula . ';';
                 }
                 @($r = eval($eval_str));
                 if ($r !== null) {
                     $fv = $formula;
                 }
                 return $fv;
             } else {
                 return '';
             }
             break;
         case 'checkbox':
             return str_replace("\n", '<br>', $value);
             break;
         case 'url':
             if (strlen($value) > 0) {
                 if (!strstr($value, '://')) {
                     $value = 'http://' . $value;
                 }
                 if ($is_export) {
                     return $value;
                 } else {
                     return '<a href="' . $value . '" target="blank">' . t::__('view') . '</a>';
                 }
             } else {
                 return '';
             }
             break;
         case 'textarea':
             return nl2br($value);
             break;
         default:
             return $value;
             break;
     }
 }
Example #24
0
<?php

include '../bootstrap.php';
$config = array('host' => 'localhost', 'user' => 'root', 'password' => 'ghjrcbvf', 'schema' => 'test', 'charset' => 'utf8', 'fetch' => MYSQL_ASSOC);
$db = FireKit\Factories\DataProviderFactory::createProvider('MYSQL', $config);
$db->Connect();
class t extends FireKit\Database\Model\ModelTable
{
    protected $table = array('name' => 'ttt', 'structure' => array("id" => array("type" => "bigint", "options" => array("not null", "auto_increment"), "key" => "primary", "comment" => "rowid"), "crdate" => array("type" => "timestamp", "default" => "CURRENT_TIMESTAMP", "options" => array("not null")), "value" => array("type" => "varchar", "size" => "100", "comment" => "тестовое поле, текстовое")), 'indexes' => array("UK" => array(array("name" => "ttt_name_ui", "fields" => array("crdate")))), "options" => array("engine" => "MyISAM", "charset" => "utf8", "collate" => "utf8_general_ci"));
    protected $relations = array("users" => array("table" => "users", "key" => "id2"), "users_temp" => array("table" => "users_temp"));
}
$m = new t($db);
$m->Cols("users.login")->With("users")->Many(false, false, 1);
echo $m->GetTotal() . "\n\n\n";
//$m->With("users")->One(1);
//echo $m->DescribeObject()."\n";
//$m->Delete(false, array("users"=>"id2"));
$sql_poll = $m->GetQueries();
echo "Queries poll:\n";
var_dump($sql_poll);
$db->Disconnect();
Example #25
0
 public static function getAccessTable($ug, $type = '', $include_reports = true)
 {
     $html = '';
     switch ($type) {
         case 'projects':
             $html = '
         <table class="listingDataTable">
           <tr>
             <td><b>' . t::__('Projects') . ':</b></td>
             <td>' . UsersGroups::getAccessNameByKey($ug->getAllowManageProjects()) . '</td>
           </tr>              
           <tr>
             <td>' . t::__('Comments') . ':</td>
             <td>' . UsersGroups::getAccessNameByValue($ug->getAllowManageProjects()) . '</td>
           </tr>
           </table>
           <table class="listingDataTable">' . ($include_reports ? '<tr>
             <td>' . t::__('Projects Reports') . ':</td>
             <td>' . UsersGroups::getAccessNameByValue($ug->getAllowManageProjects()) . '</td>
           </tr>' : '') . '
          </table>';
             break;
         case 'tasks':
             $html = '
         <table class="listingDataTable">
           <tr>
             <td ><b>' . t::__('Tasks') . ':</b></td>
             <td>' . UsersGroups::getAccessNameByKey($ug->getAllowManageTasks()) . '</td>
           </tr>
           <tr>
             <td>' . t::__('Comments') . ':</td>
             <td>' . UsersGroups::getAccessNameByValue($ug->getAllowManageTasks()) . '</td>
           </tr>
           </table>' . ($include_reports ? '<table class="listingDataTable">
           <tr>
             <td>' . t::__('Tasks Reports') . ':</td>
             <td>' . UsersGroups::getAccessNameByValue($ug->getAllowManageTasks()) . '</td>
           </tr>
           <tr>
             <td>' . t::__('Gantt Chart') . ':</td>
             <td>' . UsersGroups::getAccessNameByValue($ug->getAllowManageTasks()) . '</td>
           </tr>
           <tr>
             <td>' . t::__('Time Report') . ':</td>
             <td>' . UsersGroups::getAccessNameByValue($ug->getAllowManageTasks()) . '</td>
           </tr>
           <tr>
             <td>' . t::__('Personal Time Report') . ':</td>
             <td>' . UsersGroups::getAccessNameByValue($ug->getAllowManageTasks()) . '</td>
           </tr> 
          </table>' : '');
             break;
         case 'tickets':
             $html = '
         <table class="listingDataTable">
           <tr>
             <td style="font-size: 11px;"><b>' . t::__('Tickets') . ':</b></td>
             <td>' . UsersGroups::getAccessNameByKey($ug->getAllowManageTickets()) . '</td>
           </tr>
           <tr>
             <td>' . t::__('Comments') . ':</td>
             <td>' . UsersGroups::getAccessNameByValue($ug->getAllowManageTickets()) . '</td>
           </tr>
           </table>' . ($include_reports ? '<table class="listingDataTable">
           <tr>
             <td>' . t::__('Tickets Reports') . ':</td>
             <td>' . UsersGroups::getAccessNameByValue($ug->getAllowManageTickets()) . '</td>
           </tr> 
          </table>' : '');
             break;
         case 'discussions':
             $html = '
         <table class="listingDataTable">
           <tr>
             <td><b>' . t::__('Discussions') . ':</b></td>
             <td>' . UsersGroups::getAccessNameByKey($ug->getAllowManageDiscussions()) . '</td>
           </tr>
           <tr>
             <td>' . t::__('Comments') . ':</td>
             <td>' . UsersGroups::getAccessNameByValue($ug->getAllowManageDiscussions()) . '</td>
           </tr>
           </table>' . ($include_reports ? '<table class="listingDataTable">
           <tr>
             <td>' . t::__('Discussions Reports') . ':</td>
             <td>' . UsersGroups::getAccessNameByValue($ug->getAllowManageDiscussions()) . '</td>
           </tr> 
          </table>' : '');
             break;
         case 'extra':
             $html = '
         <table class="listingDataTable">
           <tr>
             <td><b>' . t::__('Configuration') . ':</b></td>
             <td>' . UsersGroups::getAccessNameByValue($ug->getAllowManageConfiguration()) . '</td>
           </tr>
           <tr>
             <td>' . t::__('Users') . ':</td>
             <td>' . UsersGroups::getAccessNameByValue($ug->getAllowManageUsers()) . '</td>
           </tr>
          </table>';
             break;
     }
     $html = str_replace('<td>', '<td style="white-space:normal">', $html);
     return $html;
 }
Example #26
0
 function foo()
 {
     t::bar();
 }
Example #27
0
    }
    static function getInstance()
    {
        if (self::$con instanceof self) {
            return self::$con;
        } else {
            self::$con = new self();
            return self::$con;
        }
    }
}
class t extends M
{
}
$t1 = t::getInstance();
$t2 = t::getInstance();
$t3 = clone $t2;
var_dump($t1);
var_dump($t2);
var_dump($t3);
if ($t1 === $t2) {
    echo 't1 === t2<br/>';
} else {
    echo 't1!==t2<br/>';
}
if ($t2 === $t3) {
    echo 't2 === t3<br/>';
} else {
    echo 't2!== t3<br/>';
}
/*
Example #28
0
function main()
{
    a::f();
    t::f();
}
Example #29
0
 public function executeDoSaveFilter(sfWebRequest $request)
 {
     Tasks::saveTasksFilter($request, $this->getUser()->getAttribute('gantt_filter' . $this->get_pid($request)), $this->getUser(), 'ganttChart');
     $this->getUser()->setFlash('userNotices', t::__('Filter Saved'));
     $this->redirect('ganttChart/index' . $this->add_pid($request));
 }
Example #30
0
$id = Thread::getChildThreadID();
$phrase = Thread::getChildPhrase();
$name = Thread::getPhraseName();
$myname = basename($_SERVER[PHP_SELF]);
t::i($id, $myname . "\t " . $name . " ENTER THREAD");
switch ($name) {
    case "INIT_SUM":
        $data = Thread::getChildParams("data");
        $subtotal = 0;
        foreach ($data as $i) {
            $subtotal += $i;
        }
        if ($phrase == 1) {
            t::i($id, "Specified reducer at phrase " . $phrase);
        }
        echo $subtotal;
        break;
    case "SUM_SUM":
        $data = Thread::getChildParams("data");
        $subtotal = 0;
        foreach ($data as $i) {
            $subtotal += $i;
        }
        if ($phrase == 2) {
            t::i($id, "Specified reducer at phrase " . $phrase);
        }
        echo $subtotal;
        break;
}
t::i($id, $myname . "\t " . $name . " COMPLETE: " . $subtotal);