Exemplo n.º 1
0
 public function findDepartmentName($comp_code = null)
 {
     //function to find all company name
     App::import("Model", "Departments");
     $model = new Departments();
     $query = $model->find('list', array('fields' => array('dept_code', 'dept_name'), 'conditions' => array('comp_code' => $comp_code)));
     if (empty($query)) {
         return 0;
     } else {
         return $query;
     }
 }
Exemplo n.º 2
0
 public function executeGoto(sfWebRequest $request)
 {
     $q = Doctrine_Core::getTable('Tickets')->createQuery('t')->leftJoin('t.TicketsStatus ts')->leftJoin('t.TicketsTypes tt')->leftJoin('t.Departments td')->leftJoin('t.Projects p')->leftJoin('t.Users');
     $q->addWhere('projects_id=?', $request->getParameter('projects_id'));
     if (Users::hasAccess('view_own', 'tickets', $this->getUser(), $request->getParameter('projects_id'))) {
         $q->addWhere("t.departments_id in (" . implode(',', Departments::getDepartmentIdByUserId($this->getUser()->getAttribute('id'))) . ") or t.users_id='" . $this->getUser()->getAttribute('id') . "'");
     }
     $q = Tickets::addFiltersToQuery($q, $this->getUser()->getAttribute('tickets_filter' . ((int) $request->getParameter('projects_id') > 0 ? $request->getParameter('projects_id') : '')));
     $q = app::addListingOrder($q, 'tickets', $this->getUser(), (int) $request->getParameter('projects_id'));
     $this->menu = array();
     $ids = array();
     foreach ($q->fetchArray() as $v) {
         if (strlen($sn = app::getArrayName($v, 'TicketsStatus')) > 0) {
             $sn = $sn . ': ';
         } else {
             $sn = '';
         }
         if ($request->getParameter('tickets_id') == $v['id']) {
             $v['name'] = '<b>' . $v['name'] . '</b>';
         }
         $this->menu[] = array('title' => $sn . $v['name'], 'url' => 'ticketsComments/index?projects_id=' . $request->getParameter('projects_id') . '&tickets_id=' . $v['id']);
         $ids[] = $v['id'];
     }
     $current_key = array_search($request->getParameter('tickets_id'), $ids);
     $this->previous_item_id = false;
     $this->next_item_id = false;
     if (isset($ids[$current_key - 1])) {
         $this->previous_item_id = $ids[$current_key - 1];
     }
     if (isset($ids[$current_key + 1])) {
         $this->next_item_id = $ids[$current_key + 1];
     }
 }
Exemplo n.º 3
0
 public static function checkViewOwnAccess($c, $sf_user, $tickets, $project = false)
 {
     if ($project) {
         $has_access = Users::hasAccess('view_own', 'tickets', $sf_user, $project->getId());
     } else {
         $has_access = Users::hasAccess('view_own', 'tickets', $sf_user);
     }
     if ($has_access) {
         if (!in_array($tickets->getDepartmentsId(), Departments::getDepartmentIdByUserId($sf_user->getAttribute('id'))) and $tickets->getUsersId() != $sf_user->getAttribute('id')) {
             $c->redirect('accessForbidden/index');
         }
     }
 }
Exemplo n.º 4
0
 public function executeListing(sfWebRequest $request)
 {
     if (!isset($this->reports_id)) {
         $this->reports_id = false;
     }
     $q = Doctrine_Core::getTable('Tickets')->createQuery('t')->leftJoin('t.TicketsStatus ts')->leftJoin('t.TicketsTypes tt')->leftJoin('t.Departments td')->leftJoin('t.Projects p')->leftJoin('t.Users');
     if ($request->hasParameter('projects_id')) {
         $q->addWhere('projects_id=?', $request->getParameter('projects_id'));
         if (Users::hasAccess('view_own', 'tickets', $this->getUser(), $request->getParameter('projects_id'))) {
             $q->addWhere("t.departments_id in (" . implode(',', Departments::getDepartmentIdByUserId($this->getUser()->getAttribute('id'))) . ") or t.users_id='" . $this->getUser()->getAttribute('id') . "'");
         }
     } else {
         if (Users::hasAccess('view_own', 'projects', $this->getUser())) {
             $q->addWhere("find_in_set('" . $this->getUser()->getAttribute('id') . "',team) or p.created_by='" . $this->getUser()->getAttribute('id') . "'");
         }
         if (Users::hasAccess('view_own', 'tickets', $this->getUser())) {
             $q->addWhere("t.departments_id in (" . implode(',', Departments::getDepartmentIdByUserId($this->getUser()->getAttribute('id'))) . ") or t.users_id='" . $this->getUser()->getAttribute('id') . "'");
         }
     }
     if ($this->reports_id > 0) {
         $q = TicketsReports::addFiltersToQuery($q, $this->reports_id, $this->getUser());
     } elseif ($request->hasParameter('search')) {
         $q = app::addSearchQuery($q, $request->getParameter('search'), 'TicketsComments', 't', $request->getParameter('search_by_extrafields'));
         $q = app::addListingOrder($q, 'tickets', $this->getUser());
     } else {
         $q = Tickets::addFiltersToQuery($q, $this->getUser()->getAttribute('tickets_filter' . ((int) $request->getParameter('projects_id') > 0 ? $request->getParameter('projects_id') : '')));
         $q = app::addListingOrder($q, 'tickets', $this->getUser(), (int) $request->getParameter('projects_id'));
     }
     if (sfConfig::get('app_rows_limit') > 0) {
         $this->pager = new sfDoctrinePager('Tickets', sfConfig::get('app_rows_limit'));
         $this->pager->setQuery($q);
         $this->pager->setPage($request->getParameter('page', 1));
         $this->pager->init();
     }
     $this->tickets_list = $q->fetchArray();
     if (isset($this->is_dashboard)) {
         $this->url_params = 'redirect_to=dashboard';
         $this->display_insert_button = true;
     } elseif ($this->reports_id > 0) {
         $this->url_params = 'redirect_to=ticketsReports' . $this->reports_id;
         $this->display_insert_button = true;
     } else {
         $this->url_params = 'redirect_to=ticketsList';
         if ($request->hasParameter('projects_id')) {
             $this->url_params = 'projects_id=' . $request->getParameter('projects_id');
         }
         $this->display_insert_button = true;
     }
     $this->tlId = rand(1111111, 9999999);
 }
 public function updateDepartment()
 {
     $validator = Validator::make(Input::all(), array('name' => 'required', 'id' => 'required', 'shortname' => 'required', 'head' => 'required', 'description' => 'required', 'facultyId' => 'required|numeric'));
     if ($validator->fails()) {
         // If not inform user of errors.
         return Response::json(array('success' => false, 'errors' => $validator->messages()));
     } else {
         // Check user has permission to create department.
         if (Auth::user()->rank == 3) {
             // Load the Department.
             $department = Departments::find(Input::get('id'));
             // Save changes.
             $department->departmentname = Input::get('name');
             $department->departmentshort = Input::get('shortname');
             $department->departmenthead = Input::get('head');
             $department->departmentdescription = Input::get('description');
             $department->facultyid = Input::get('facultyId');
             $department->save();
             // If not inform user of errors.
             return Response::json(array('success' => true));
         }
     }
 }
Exemplo n.º 6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getDepartments()
 {
     return $this->hasMany(Departments::className(), ['companies_company_id' => 'company_id']);
 }
Exemplo n.º 7
0
foreach ($doctors->doctors as $doctor) {
    echo "<div class='row doctor'>";
    echo "<div class='anchor' id='{$doctor->first_name}{$doctor->last_name}'></div>";
    echo "<section class='col-xs-offset-2 col-sm-offset-0 col-xs-8 col-sm-6 col-md-3'>";
    echo "<img class='img-thumbnail img-responsive' src='./images/doctors/{$doctor->image}'>";
    echo "</section>";
    echo "<section class='row infos col-xs-12 col-sm-6 col-md-9'>";
    echo "<section class='col-xs-12'>";
    echo "<h3><span class='fa fa-download fa'></span> <a href='./curricula/{$lang}/{$doctor->curriculum}' class='link'>";
    if (strcmp($doctor->gender, 'M') == 0) {
        echo "Dr.";
    } else {
        echo "Dr. ssa";
    }
    echo " {$doctor->first_name} {$doctor->last_name}</a></h3>";
    $departments = new Departments($db);
    $departments->get_by_doctor($doctor->id);
    foreach ($departments->departments as $department) {
        echo " <span class='h5'><a class='link' href='./department.php?ID={$department->id}'>{$department->name}</a></span> |";
    }
    $ambulatories = new Ambulatories($db);
    $ambulatories->get_by_doctor($doctor->id);
    foreach ($ambulatories->ambulatories as $ambulatory) {
        echo " <span class='h5'><a class='link' href='./ambulatory.php?ID={$ambulatory->id}'>{$ambulatory->name}</a></span> |";
    }
    echo "</section>";
    echo "<section class='col-xs-12'>" . $content_extractor->get_section(strtolower($doctor->first_name . $doctor->last_name), "Download " . $doctor->last_name . "'s curriculum to know more.") . "</section>";
    echo "</section>";
    echo "</div>";
}
?>
 public function getDepartments()
 {
     $model = Departments::model()->findAll();
     $result = CHtml::listData($model, 'id', 'department');
     return array_values($result);
 }
Exemplo n.º 9
0
 /**
  * @return Departments
  */
 public function getDepartments()
 {
     return Departments::getByUser($this->user_id);
 }
Exemplo n.º 10
0
        <td style="display:table-cell; text-align:justify; width:80px; height: 12px">
            <font style="font-family: sans-serif; font-weight: bold" size="11">Age:</font>
        </td>
        <td style="display:table-cell; text-align:justify; width:70px; height: 12px">
            <font style="font-family: sans-serif; font-weight: normal" size="11">
            <?php 
if (!empty($age)) {
    echo "{$age} Yrs";
}
?>
            </font>
        </td>
    </tr>

    <?php 
$department = empty($person->department) ? null : Departments::model()->findByPk($person->department);
?>
    <tr>
        <td style="display:table-cell; text-align:justify; width:100px; height: 12px">
            <font style="font-family: sans-serif; font-weight: bold" size="11">Department:</font>
        </td>
        <td style="display:table-cell; text-align:justify; width:250px; height: 12px">
            <font style="font-family: sans-serif; font-weight: normal" size="11">
            <?php 
if (!empty($department)) {
    echo $department->department;
}
?>
            </font>
        </td>
        <td style="display:table-cell; text-align:justify; width:80px; height: 12px">
 public function loadClass()
 {
     // Get the Class and it's students.
     $class = Classes::where('classId', Input::get('classId'))->first();
     $studentIds = json_decode($class->classstudents);
     $students = array();
     // Loop through all studentIds and get relevant info.
     foreach ($studentIds as $s) {
         // Get current student.
         $user = User::find($s);
         // Save name and username.
         $name = $user->name;
         $username = $user->username;
         $email = $user->email;
         // Get the major.
         $major = Departments::find($user->department)->name();
         // Push to students array.
         array_push($students, array('id' => $s, 'name' => $name, 'username' => $username, 'major' => $major, 'email' => $email));
     }
     return Response::json(array('success' => true, 'limit' => $class->classlimit, 'space' => $class->classlimit - $class->classcurrent, 'students' => $students));
 }
Exemplo n.º 12
0
    }
    function getEmployee($username)
    {
        $query = $this->connection->prepare("SELECT username, firstname, surname FROM employees WHERE username = ? LIMIT 1;");
        $query->bind_param('s', $username);
        $query->execute();
        $result = $query->get_result();
        $row = $result->fetch_assoc();
        return new Employee($row['username'], $row['firstname'], $row['surname']);
    }
    private $connection;
}
?>

<form action='listDepartments.php' method='POST'>
<input name='term' placeholder='search'><br/>
<input type='submit' value="Search">
</form>

<?php 
if (isset($_POST['term'])) {
    $term = $_POST['term'];
    $connection = mysqli_connect("localhost", "root", "", "pyus");
    $departments = new Departments($connection);
    foreach ($departments->search($term) as $department) {
        echo "<b>" . $department->name . "</b></br>";
        foreach ($department->roles as $role) {
            echo $role->name . " " . $role->employee->firstname . " " . $role->employee->surname . "<br/>";
        }
    }
}
Exemplo n.º 13
0
        <?php 
echo CHtml::error($model, 'membershipno');
?>
    </div>
</div>
-->
<div class="form-group">
    <?php 
echo CHtml::activeLabelEx($model, 'department', array('class' => $label_class));
?>
    <div class="<?php 
echo $input_class;
?>
" style="padding-top: 4px;">
        <?php 
$depts = Departments::model()->findAll(array('order' => 'department ASC'));
$depts = CHtml::listData($depts, 'id', 'department');
?>
        <?php 
echo CHtml::activeDropDownList($model, 'department', $depts, array('prompt' => $model->getAttributeLabel('department'), 'class' => 'form-control'));
?>
        <?php 
echo CHtml::error($model, 'department');
?>
    </div>
</div>

<div class="form-group">
    <?php 
echo CHtml::activeLabelEx($model, 'payrollno', array('class' => $label_class));
?>
Exemplo n.º 14
0
<?php

session_start();
include '../class/config.php';
include '../class/class_departments.php';
$department = new Departments();
$id = $_GET['id'];
$department->departmentActivate($id);
Exemplo n.º 15
0
</head>
<body>
	<?php 
echo "<div id='header_bg_image' data-image='{$department->image}'>";
include_once "./partials/_navbar.php";
echo "</div>";
?>
	<div class="container page_section">
		<div class="row title_box">
			<div class="col-xs-12">
				<h3 class="text_stand_out text-center"><span class="fa fa-arrow-circle-o-left fa-lg scroll_arrow left_scroll_arrow" data-id="#dep-scroll"></span>servizi<span class=" fa fa-arrow-circle-o-right fa-lg scroll_arrow right_scroll_arrow" data-id="#dep-scroll"></span></h3>
			</div>
		</div>
		<div class="row h_scroll" id="dep-scroll">
			<?php 
$all_deps = new Departments($db);
$all_deps->get_all();
foreach ($all_deps->departments as $one_d) {
    echo "<section class='col-xs-6 col-sm-3 h_scroll_box h_scroll_box'>";
    echo "<img class='img-thumbnail img-responsive' src='./images/departments/small/{$one_d->image}'>";
    echo "<h5 class='text-capitalize h_scroll_text'><a href='./department.php?ID={$one_d->id}' class='link'>{$one_d->name}</a></h5>";
    echo "</section>";
}
?>
		</div>
	</div>
	<div class="container page_section">
		<div class="row">
			<section class="department_description col-xs-12">
				<div class="row">
					<div class="title_box col-xs-12">
Exemplo n.º 16
0
							</span>
					</section>
				</div>
			</div>
		</div>
		<div id="services_bg_image">
			<div class="container page_section" id="services">
				<div class="anchor" id="services-a"></div>
				<div class="row title_box">
					<div class="col-xs-12">
						<h3 class="text_stand_out text-center"><span class="fa fa-arrow-circle-o-left fa-lg scroll_arrow left_scroll_arrow" data-id="#dep-scroll"></span>servizi<span class=" fa fa-arrow-circle-o-right fa-lg scroll_arrow right_scroll_arrow" data-id="#dep-scroll"></span></h3>
					</div>
				</div>
				<div class="row h_scroll" id="dep-scroll">
					<?php 
$departments = new Departments($db);
$departments->get_all();
foreach ($departments->departments as $department) {
    echo "<section class='col-xs-6 col-sm-3 h_scroll_box h_scroll_box'>";
    echo "<img class='img-thumbnail img-responsive' src='./images/departments/small/{$department->image}'>";
    echo "<h5 class='text-capitalize h_scroll_text'><a href='./department.php?ID={$department->id}' class='link'>{$department->name}</a></h5>";
    echo "</section>";
}
?>
				</div>
			</div>
		</div>
		<div id="where_bg_image">
			<div class="container page_section" id="where">
				<div class="anchor" id="where-a"></div>
				<div class="row title_box">
Exemplo n.º 17
0
 /**
  * Return department as object.
  * @return Department
  */
 public function GetOddzial()
 {
     if ($this->_IsDepartmentObjSet == false) {
         $this->_DepartmentObj = Departments::GetDepartment($this->Getdepartments_id());
         $this->_IsDepartmentObjSet = true;
     }
     return $this->_DepartmentObj;
 }
Exemplo n.º 18
0
  /**
   * Generates the HTML to display the user profile tab
   *
   * @param  \CB\Database\Table\TabTable   $tab       the tab database entry
   * @param  \CB\Database\Table\UserTable  $user      the user being displayed
   * @param  int                           $ui        1 for front-end, 2 for back-end
   * @return string|boolean                           Either string HTML for tab content, or false if ErrorMSG generated
   */
  public function getDisplayTab( $tab, $user, $ui )
  {
    $document = JFactory::getDocument();
    $document->addScript('/media/jui/js/jquery.min.js');
    $document->addScript('/media/jui/js/bootstrap.min.js');

    require_once('models/departments.php');
    require_once('templates/departments.php');
    $my = JFactory::getUser();
    $myIsRoot = $my->authorise('core.admin');

    outputCbJs( 1 );
    outputCbTemplate( 1 );


    $result = '<div class="alert alert-dismissible" role="alert" id="departmentStatusContainer" style="display:none">
  <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  <span id="departmentStatus"></span>
</div>';

    $result .= '<div id="departmentsContainer"> ';

    $clinics = Departments::getDepartments($user->id);
    $result .= DepartmentsView::renderDepartments($clinics, $user->id, $my, $myIsRoot);

    $result .= '</div>';

    $result .='
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">Введите свою должность</h4>
      </div>
      <div class="modal-body">
        <form class="form-horizontal">
          <div class="form-group">
          <input type="hidden"  id="myModal_employeeId" />
          <input type="hidden" id="myModal_departmentId" />
          <input type="text" class="form-control" id="myModal_position" placeholder="Ваша должность"/>
          </div>
        </form>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Отмена</button>
        <button type="button" class="btn btn-primary" onclick="addEmployeeToDepartmentSubmit()" >Добавить себя</button>
      </div>
    </div>
  </div>
</div>';

      $result .= '<script>

  function addNewClinic(){

    if(jQuery(\'#clinicName\').val() == ""){
      showMessage(false, "Введите название клиники");
      return;
    }
    jQuery.ajax({
      type: "POST",
      url: "'.JRoute::_("/index.php?option=com_clinicstructure&task=add_clinic").'",
      data: {clinicName:jQuery(\'#clinicName\').val(),
             clinicUrl:jQuery(\'#clinicUrl\').val(),
             profileId:"'.$user->id.'"},
      success: function(data){
        showMessage(data.success, data.message);
        updateDepartments(data.departments);
      }
    });
  }

  function addNewDepartment(clinicNumber){
    if(jQuery(\'#departmentName\'+clinicNumber).val() == ""){
      showMessage(false,"Введите название отделения");
      return;
    }
    jQuery.ajax({
      type: "POST",
      url: "'.JRoute::_("/index.php?option=com_clinicstructure&task=add").'",
      data: {clinicId:jQuery(\'#clinicId\'+clinicNumber).val(),
             departmentName:jQuery(\'#departmentName\'+clinicNumber).val(),
             departmentUrl:jQuery(\'#departmentUrl\'+clinicNumber).val(),
             profileId:"'.$user->id.'"},
      success: function(data){
        showMessage(data.success, data.message);
        updateDepartments(data.departments);
      }
    });
  }

  function deleteClinic(id){
    if(window.confirm("Вы действительно хотите удалить клинику?")){
    jQuery.ajax({
      type: "POST",
      url: "' . JRoute::_("/index.php?option=com_clinicstructure&task=delete_clinic") . '",
      data: {clinicId:id},
      success: function(data){
        showMessage(data.success, data.message);
        updateDepartments(data.departments);
      }
    });
    }
  }

  function deleteDepartment(id){
    if(window.confirm("Вы действительно хотите удалить отделение?")){
    jQuery.ajax({
      type: "POST",
      url: "' . JRoute::_("/index.php?option=com_clinicstructure&task=delete") . '",
      data: {departmentId:id},
      success: function(data){
        showMessage(data.success, data.message);
        updateDepartments(data.departments);
      }
    });
    }
  }

  function removeEmployeeFromDepartment(employeeId, departmentId){
    jQuery.ajax({
      type: "POST",
      url: "'.JRoute::_("/index.php?option=com_clinicstructure&task=removeEmployeeFromDepartment").'",
      data: {departmentId:departmentId, employeeId:employeeId},
      success: function(data){
        showMessage(data.success, data.message);
        updateDepartments(data.departments);
      }
    });
  }

  function addEmployeeToDepartment(employeeId, departmentId){
    jQuery(\'#myModal_employeeId\').val(employeeId);
    jQuery(\'#myModal_departmentId\').val(departmentId);
    jQuery(\'#myModal\').modal(\'show\');
  }

  function addEmployeeToDepartmentSubmit(){
    var employeeId = jQuery(\'#myModal_employeeId\').val();
    var departmentId = jQuery(\'#myModal_departmentId\').val();
    var position = jQuery(\'#myModal_position\').val();
    jQuery(\'#myModal\').modal(\'hide\');
    jQuery.ajax({
      type: "POST",
      url: "'.JRoute::_("/index.php?option=com_clinicstructure&task=addEmployeeToDepartment").'",
      data: {departmentId:departmentId, employeeId:employeeId, position:position},
      success: function(data){
        showMessage(data.success, data.message);
        updateDepartments(data.departments);
      }
    });
  }

  function showMessage(success, msg){
    jQuery("#departmentStatus").html(msg);
    if(success){
      jQuery("#departmentStatusContainer").addClass("alert-success");
      jQuery("#departmentStatusContainer").removeClass("alert-danger");
    }else{
      jQuery("#departmentStatusContainer").removeClass("alert-success");
      jQuery("#departmentStatusContainer").addClass("alert-danger");
    }
    jQuery("#departmentStatusContainer").show();
  }

  function updateDepartments(departments){
    jQuery("#departmentsContainer").html(departments);
  }
</script>';


    return $result;
  }
Exemplo n.º 19
0
 /**
  * Return department as object.
  * @return Department
  */
 public function GetDepartmentObj()
 {
     if ($this->_DepartmentObj == null) {
         $deps = new Departments();
         $this->_DepartmentObj = $deps->GetDepartment($this->GetDepartmentId());
     }
     return $this->_DepartmentObj;
 }
Exemplo n.º 20
0
 /**
  * Starts site synchronization process.
  * @return string
  */
 public function SynchronizeSite()
 {
     if (!$this->checkwebext()) {
         return "Function unavailable in this version.";
     }
     try {
         if (WebServiceWeb::WS()) {
             WebServiceWeb::WS()->LoginEx();
             $ret1 = WebServiceWeb::WS()->GetService();
             $ret2 = $ret3 = $ret4 = $ret5 = $ret6 = $ret7 = $ret8 = $ret9 = $ret10 = $ret11 = $ret12 = $ile = 0;
             if ($ret1 != 0) {
                 Miejsca::DeleteMiejsce(0, 0);
                 $ret2 = WebServiceWeb::WS()->GetMiejsca();
                 Menus::DeleteMenu(0);
                 $ret3 = WebServiceWeb::WS()->GetMenu();
                 Artykuly::DeleteArtykul(0);
                 $ret4 = WebServiceWeb::WS()->GetArtykuly();
                 ArkuszeSkrypty::DeleteArkuszSkrypt(0, 0);
                 $ret5 = WebServiceWeb::WS()->GetArkuszeSkrypty();
                 Banery::DeleteBaner(0);
                 $ret6 = WebServiceWeb::WS()->GetBanery();
                 Opcje::DeleteOpcja(null);
                 $ret7 = WebServiceWeb::WS()->GetOpcje();
                 JezykiTeksty::DeleteJezyk(null);
                 $ret8 = WebServiceWeb::WS()->GetJezyki();
                 $ret9 = WebServiceWeb::WS()->GetGalerie();
                 Agents::DeleteAgent(0);
                 $ret10 = WebServiceWeb::WS()->GetAgenci();
                 Departments::DeleteDepartment(0);
                 $ret11 = WebServiceWeb::WS()->GetOddzialy();
                 Osoby::DeleteOsoba(null);
                 $ret12 = WebServiceWeb::WS()->GetOsoby();
                 $ile = WebServiceWeb::WS()->HasNewsLetter();
                 $this->SaveParam(WebAPI::PARAM_HAS_NEWSLETTER, $ile > 0 ? 1 : 0);
                 GaleriePozycje::IndeksujGaleriePozycjeDlaArtykulow();
                 if (Config::$UseOptionsDiskCache) {
                     $this->ClearOptionsCache();
                 }
                 if (Config::$UseLanguageDiskCache) {
                     $this->ClearLanguageCache();
                 }
             }
             WebServiceWeb::WS()->Logout();
             return "Serwisy: {$ret1}, Miejsca: {$ret2}, Menu: {$ret3}, Artykuly: {$ret4}, Arkusze/JS: {$ret5}, Banery: {$ret6}, Opcje: {$ret7}, Jezyki: {$ret8}, Galerie: {$ret9}, NewsL: {$ile}, Agenci: {$ret10}, Oddzialy: {$ret11}, Osoby: {$ret12}";
         } else {
             return 'Error: WebServiceWeb not available';
         }
     } catch (Exception $ex) {
         Errors::LogError("WebAPI:SynchronizeSite", $ex->getMessage());
         return "ERROR";
     }
 }
Exemplo n.º 21
0
<?php

session_start();
include '../class/config.php';
include '../class/class_departments.php';
$department = new Departments();
$id = $_GET['id'];
$department->departmentDeactivate($id);
 /** 
  * Function that updates specified department.
  */
 protected function updateDepartment($id, $expected)
 {
     if ($expected) {
         $response = $this->call('POST', '/account/update-department', ['name' => 'phpunitDepartment123', 'shortname' => 'phpunitDepartment', 'head' => 'headofdepartment', 'description' => str_random(60), 'facultyId' => 1, 'id' => $id]);
         $json = json_decode($response->getContent());
         $this->assertEquals(true, $json->success);
         // Verify that the change was made.
         $d = Departments::find($id);
         $this->assertEquals('phpunitDepartment123', $d->departmentname);
         return $d;
     } else {
         $response = $this->call('POST', '/account/update-department', ['name' => 'phpunitDepartment123', 'shortname' => 'phpunitDepartment', 'head' => 'headofdepartment', 'description' => str_random(60), 'facultyId' => 'one', 'id' => $id]);
         $json = json_decode($response->getContent());
         $this->assertEquals(false, $json->success);
     }
 }
Exemplo n.º 23
0
  public function removeEmployeeFromDepartment(){
    $app = JFactory::getApplication();
    $user = JFactory::getUser();
    $isRoot = $user->authorise('core.admin');

    $input = $app->input;
    header('Content-Type: application/json');

    //Only Authorised users can add departments.
    if ($user->get('guest') == 1)
    {
      echo json_encode(array("success"=>false, 'message'=>'Вы должны авторизироваться.'));
      JFactory::getApplication()->close();
      return;
    }
    //OK now get request parameters
    $employeeId = $input->getInt('employeeId');
    $departmentId = $input->getInt('departmentId');
    //Check if department exists
    $department = Departments::getDepartment($departmentId);
    if($department==null){
      echo json_encode(array("success"=>false, 'message'=>'Такого отделения не существует.'));
      JFactory::getApplication()->close();
      return;
    }
    //Now check if this user has access rights to perform this operation
    if(!($isRoot || $user->get('id')==$department->profile_id || $user->get('id') == $employeeId)){
      echo json_encode(array("success"=>false, 'message'=>'У вас недостаточно прав для выполнения операции.'));
      JFactory::getApplication()->close();
      return;
    }

    //OK now we can remove user from department

    Departments::removeUserFromDeparmtent($employeeId, $departmentId);

    $result = array('success'=>true, 'message'=>'Пользователь удален',
      'departments'=>DepartmentsView::renderDepartments(Departments::getDepartments($department->profile_id ),$department->profile_id ,$user, $isRoot));
    echo json_encode( $result );
    JFactory::getApplication()->close();
  }
Exemplo n.º 24
0
<?php

session_start();
include '../class/config.php';
include '../class/class_departments.php';
$dept = new Departments();
$id = $_GET['id'];
$dept->departmentData($id);
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $name = mysql_escape_string($_POST['name']);
    $description = mysql_escape_string($_POST['description']);
    $id = mysql_escape_string($_POST['dept_id']);
    $dept->name = $name;
    $dept->description = $description;
    $dept->departmentEdit($id);
}
?>

<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>E-Blast</title>
Exemplo n.º 25
0
<?php

session_start();
include '../class/config.php';
include '../class/class_departments.php';
$deparment = new Departments();
if (!isset($_SESSION['username'])) {
    header("Location: ../login.php");
}
//echo $_SESSION['admin_login'];
?>
<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>E-Blast</title>

    <!-- Bootstrap Core CSS -->
    <link href="<?php 
echo $url;
?>
css/bootstrap.min.css" rel="stylesheet">

    <!-- MetisMenu CSS -->
Exemplo n.º 26
0
 /**
  * Get a list of departments to be added or remove. Write the department to database.
  * @param int $id
  * @return int
  */
 public function GetOddzialy($id = 0)
 {
     if (!$this->WS()) {
         return null;
     }
     try {
         $params = array('sid' => $this->_sid, 'id' => $id);
         $result = $this->WS()->getSC()->__soapCall("GetOddzialy", array($params));
         if ($result->GetOddzialyResult->Status != 0) {
             Errors::LogError("WebService:GetOddzialy", "Response: " . $result->GetOddzialyResult->Message);
             return 0;
         }
         $xml = simplexml_load_string($result->GetOddzialyResult->XMLContent);
         $cnt = 0;
         foreach ($xml->children() as $node) {
             $dep = new Department($node["ID"], $node->Nazwa, $node->Nazwa2, $node->Adres, $node->Miasto, $node->Kod, $node->Nip, $node->Wojewodztwo, $node->Www, $node->Telefon, $node->Email, $node->Fax, $node->Uwagi, $node->Naglowek, $node->Stopka, $node->PlikLogo, $node->ZdjecieWWW, $node->Subdomena, $node->Firma);
             Departments::AddEditDepartment($dep);
             echo DataBase::GetDbInstance()->LastError();
             $cnt++;
         }
         return $cnt;
     } catch (Exception $ex) {
         Errors::LogError("WebService:GetOddzialy", $ex->getMessage());
         return 0;
     }
 }
Exemplo n.º 27
0
 /**
  * Return department as object.
  * @return Department
  */
 public function GetDepartmentObj()
 {
     if ($this->_DepartmentObj == null) {
         $this->_DepartmentObj = Departments::GetDepartment($this->GetDepartmentId());
     }
     return $this->_DepartmentObj;
 }
Exemplo n.º 28
0
 public function executeExport(sfWebRequest $request)
 {
     /*check access*/
     if ($request->hasParameter('projects_id')) {
         $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('view', false, $this->projects);
     } else {
         $this->checkTicketsAccess('view');
     }
     $this->columns = array('Projects' => t::__('Project Name'), 'id' => t::__('Id'), 'TicketsStatus' => t::__('Status'), 'TicketsTypes' => t::__('Type'), 'name' => t::__('Name'), 'description' => t::__('Description'), 'Departments' => t::__('Department'), 'Users' => t::__('Created By'), 'created_at' => t::__('Created At'));
     $extra_fields = ExtraFieldsList::getFieldsByType('tickets', $this->getUser(), false, array('all' => true));
     foreach ($extra_fields as $v) {
         $this->columns['extra_field_' . $v['id']] = $v['name'];
     }
     if (!$request->hasParameter('projects_id')) {
         $this->columns['Projects'] = t::__('Project');
     }
     $this->columns['Projects'] = t::__('Project Name');
     $this->columns['url'] = t::__('Url');
     if ($fields = $request->getParameter('fields')) {
         $separator = "\t";
         $format = $request->getParameter('format', '.csv');
         $filename = $request->getParameter('filename', 'tasks');
         header("Content-type: Application/octet-stream");
         header("Content-disposition: attachment; filename=" . $filename . "." . $format);
         header("Pragma: no-cache");
         header("Expires: 0");
         $content = '';
         foreach ($fields as $f) {
             $content .= str_replace(array("\n\r", "\r", "\n", $separator), ' ', $this->columns[$f]) . $separator;
         }
         $content .= "\n";
         if ($format == 'csv') {
             echo chr(0xff) . chr(0xfe) . mb_convert_encoding($content, 'UTF-16LE', 'UTF-8');
         } else {
             echo $content;
         }
         if (strlen($request->getParameter('selected_items') == 0)) {
             exit;
         }
         $q = Doctrine_Core::getTable('Tickets')->createQuery('t')->leftJoin('t.TicketsStatus ts')->leftJoin('t.TicketsTypes tt')->leftJoin('t.Departments td')->leftJoin('t.Projects p')->leftJoin('t.Users')->whereIn('t.id', explode(',', $request->getParameter('selected_items')));
         if ($request->hasParameter('projects_id')) {
             $q->addWhere('projects_id=?', $request->getParameter('projects_id'));
             if (Users::hasAccess('view_own', 'tickets', $this->getUser(), $request->getParameter('projects_id'))) {
                 $q->addWhere("t.departments_id in (" . implode(',', Departments::getDepartmentIdByUserId($this->getUser()->getAttribute('id'))) . ") or t.users_id='" . $this->getUser()->getAttribute('id') . "'");
             }
         } else {
             if (Users::hasAccess('view_own', 'projects', $this->getUser())) {
                 $q->addWhere("find_in_set('" . $this->getUser()->getAttribute('id') . "',team) or p.users_id='" . $this->getUser()->getAttribute('id') . "'");
             }
             if (Users::hasAccess('view_own', 'tickets', $this->getUser())) {
                 $q->addWhere("t.departments_id in (" . implode(',', Departments::getDepartmentIdByUserId($this->getUser()->getAttribute('id'))) . ") or t.users_id='" . $this->getUser()->getAttribute('id') . "'");
             }
         }
         if ($request->hasParameter('projects_id')) {
             $q = app::addListingOrder($q, 'tickets', $this->getUser(), (int) $request->getParameter('projects_id'));
         } else {
             $q->orderBy('LTRIM(p.name), ts.sort_order, LTRIM(ts.name), LTRIM(t.name)');
         }
         $tickets = $q->fetchArray();
         $totals = array();
         $projects_totals = array();
         $current_project_id = 0;
         foreach ($tickets as $t) {
             $ex_values = ExtraFieldsList::getValuesList($extra_fields, $t['id']);
             $content = '';
             //
             if ($current_project_id == 0) {
                 $current_project_id = $t['projects_id'];
             }
             if ($current_project_id != $t['projects_id']) {
                 //adding totals
                 if (isset($projects_totals[$current_project_id])) {
                     foreach ($fields as $f) {
                         $v = '';
                         if (strstr($f, 'extra_field_')) {
                             if (isset($projects_totals[$current_project_id][str_replace('extra_field_', '', $f)])) {
                                 $v = $projects_totals[$current_project_id][str_replace('extra_field_', '', $f)];
                             }
                         }
                         $content .= str_replace(array("\n\r", "\r", "\n", $separator), ' ', $v) . $separator;
                     }
                     $content .= "\n\n";
                 }
                 $current_project_id = $t['projects_id'];
             }
             foreach ($fields as $f) {
                 $v = '';
                 if (in_array($f, array('id', 'name', 'description'))) {
                     $v = $t[$f];
                 } elseif (strstr($f, 'extra_field_')) {
                     if ($ex = Doctrine_Core::getTable('ExtraFields')->find(str_replace('extra_field_', '', $f))) {
                         $v = ExtraFieldsList::renderFieldValueByType($ex, $ex_values, array(), true);
                         if (in_array($ex->getType(), array('number', 'formula'))) {
                             if (!isset($totals[$ex->getId()])) {
                                 $totals[$ex->getId()] = 0;
                             }
                             if (!isset($projects_totals[$t['projects_id']][$ex->getId()])) {
                                 $projects_totals[$t['projects_id']][$ex->getId()] = 0;
                             }
                             $totals[$ex->getId()] += $v;
                             $projects_totals[$t['projects_id']][$ex->getId()] += $v;
                         }
                         $v = str_replace('<br>', ', ', $v);
                     }
                 } elseif ($f == 'created_at') {
                     if (strlen($t[$f]) > 0) {
                         $v = app::dateTimeFormat($t[$f]);
                     }
                 } elseif ($f == 'url') {
                     $v = app::public_url('ticketsComments/index?projects_id=' . $t['projects_id'] . '&tickets_id=' . $t['id']);
                 } else {
                     $v = app::getArrayName($t, $f);
                 }
                 $content .= str_replace(array("\n\r", "\r", "\n", $separator), ' ', $v) . $separator;
             }
             $content .= "\n";
             if ($format == 'csv') {
                 echo chr(0xff) . chr(0xfe) . mb_convert_encoding($content, 'UTF-16LE', 'UTF-8');
             } else {
                 echo $content;
             }
         }
         $content = '';
         //adding totals
         if (isset($projects_totals[$current_project_id]) and !$request->hasParameter('projects_id')) {
             foreach ($fields as $f) {
                 $v = '';
                 if (strstr($f, 'extra_field_')) {
                     if (isset($projects_totals[$current_project_id][str_replace('extra_field_', '', $f)])) {
                         $v = $projects_totals[$current_project_id][str_replace('extra_field_', '', $f)];
                     }
                 }
                 $content .= str_replace(array("\n\r", "\r", "\n", $separator), ' ', $v) . $separator;
             }
             $content .= "\n\n";
         }
         foreach ($fields as $f) {
             $v = '';
             if (strstr($f, 'extra_field_')) {
                 if (isset($totals[str_replace('extra_field_', '', $f)])) {
                     $v = $totals[str_replace('extra_field_', '', $f)];
                 }
             }
             $content .= str_replace(array("\n\r", "\r", "\n", $separator), ' ', $v) . $separator;
         }
         $content .= "\n";
         if ($format == 'csv') {
             echo chr(0xff) . chr(0xfe) . mb_convert_encoding($content, 'UTF-16LE', 'UTF-8');
         } else {
             echo $content;
         }
         exit;
     }
 }
Exemplo n.º 29
0
 /**
  * Get a list of offers to be added or remove. Write the offers to the database.
  * @param boolean $archive
  * @param string &$log
  * @param array &$count_arr
  * @return null|int|array
  * @throws Exception 
  */
 private function GetOffersPartial($archive, &$log, &$count_arr)
 {
     Errors::LogSynchroStep('WebServiceVirgo - GetOffersPartial() start...');
     if (!$this->WS()) {
         Errors::LogSynchroStep('WebServiceVirgo - NO WEBSERVICE');
         return null;
     }
     try {
         $log .= "archive=" . (int) $archive . "\n";
         $time_start = microtime_float();
         if ($this->_sid == "") {
             return;
         }
         $params = array('sid' => $this->_sid);
         if ($archive) {
             $result = $this->WS()->getSC()->__soapCall("GetOffersArchive", array($params));
             $buf = $result->GetOffersArchiveResult->OffersZip;
             $status = $result->GetOffersArchiveResult->Status;
             $msg = $result->GetOffersArchiveResult->Message;
         } else {
             $result = $this->WS()->getSC()->__soapCall("GetOffers", array($params));
             $buf = $result->GetOffersResult->OffersZip;
             $status = $result->GetOffersResult->Status;
             $msg = $result->GetOffersResult->Message;
         }
         $time_end = microtime_float();
         $time = $time_end - $time_start;
         if ($this->_DEBUG) {
             echo "SOAP Call execution time: {$time} seconds<br>";
         }
         if ($status != 0) {
             throw new Exception($msg);
         }
         $zip_file = $archive ? self::TMP_ZIP_ARCH_FILE : self::TMP_ZIP_FILE;
         $f = fopen($zip_file, "w");
         fwrite($f, $buf);
         fclose($f);
         $time_end2 = microtime_float();
         $time = $time_end2 - $time_end;
         if ($this->_DEBUG) {
             echo "Save ZIP execution time: {$time} seconds<br>";
         }
         //unzip XML file with offers
         $contents = "";
         $zip = new ZipArchive();
         if ($zip->open($zip_file)) {
             $fp = $zip->getStream('xml.xml');
             if (!$fp) {
                 exit("failed reading xml file (" . getcwd() . "), probably invalid permissions to folder\n");
             }
             $contents = '';
             while (!feof($fp)) {
                 $contents .= fread($fp, 1024);
             }
             fclose($fp);
             $zip->close();
             $xml_file = $archive ? self::TMP_XML_OFE_ARCH_FILE : self::TMP_XML_OFE_FILE;
             file_put_contents($xml_file, $contents);
             if (file_exists($zip_file)) {
                 unlink($zip_file);
             }
         }
         $time_end3 = microtime_float();
         $time = $time_end3 - $time_end2;
         if ($this->_DEBUG) {
             echo "Save XML execution time: {$time} seconds<br>";
         }
         $times = array("read_props" => 0, "save" => 0, "del_props" => 0, "rooms" => 0, "del_offers" => 0, "rooms_del" => 0, "photos" => 0);
         $prevOfferId = "0";
         $content = file_get_contents($xml_file);
         //$content = preg_replace("/<UwagiOpis>([^\<\>]*)\<\/UwagiOpis>/m", "<UwagiOpis><![CDATA[$1]]></UwagiOpis>", $content);
         //$content = preg_replace("/<UwagiNieruchomosc>([^\<\>]*)\<\/UwagiNieruchomosc>/m", "<UwagiNieruchomosc><![CDATA[$1]]></UwagiNieruchomosc>", $content);
         $fp = fopen($xml_file, 'w');
         fwrite($fp, $content);
         fclose($fp);
         //open and read XML file
         $xml2 = new XMLReader();
         $xml2->open($xml_file);
         $domdoc = new DOMDocument();
         $ids_do_usuniecia_dodania = array();
         $all_agents_ids = array();
         $all_dept_ids = array();
         $blokuj_agentow = true;
         $blokuj_oddzialy = true;
         $time_end4 = microtime_float();
         $time = $time_end4 - $time_end3;
         if ($this->_DEBUG) {
             echo "Load XML execution time: {$time} seconds<br>";
         }
         $xml2->read();
         while ($xml2->name) {
             //Departments
             if ($xml2->name == "Oddzial") {
                 if ($blokuj_oddzialy) {
                     $blokuj_oddzialy = false;
                 }
                 $node = simplexml_import_dom($domdoc->importNode($xml2->expand(), true));
                 if (count($node) > 0) {
                     $log .= "oddzial=" . $node["ID"] . " - " . $node->Nazwa . "\n";
                     $dep = new Department($node["ID"], $node->Nazwa, $node->Nazwa2, $node->Adres, $node->Miasto, $node->Kod, $node->Nip, $node->Wojewodztwo, $node->Www, $node->Telefon, $node->Email, $node->Fax, $node->Uwagi, $node->Naglowek, $node->Stopka, $node->PlikLogo, $node->ZdjecieWWW, $node->Subdomena, $node->Firma);
                     array_push($all_dept_ids, (int) $node["ID"]);
                     Departments::AddEditDepartment($dep);
                     echo DataBase::GetDbInstance()->LastError();
                 }
             }
             //Agents
             if ($xml2->name == "Agent") {
                 if ($blokuj_agentow) {
                     $blokuj_agentow = false;
                 }
                 $node = simplexml_import_dom($domdoc->importNode($xml2->expand(), true));
                 if (count($node) > 0) {
                     $log .= "agent=" . $node["ID"] . " - " . $node->Nazwa . "\n";
                     $kod_pracownika = 0;
                     if (is_numeric($node->KodPracownika)) {
                         $kod_pracownika = (int) $node->KodPracownika;
                     }
                     $agent = new Agent($node["ID"], $node->Nazwa, $node->Telefon, $node->Komorka, $node->Email, $node->Oddzial, $node->JabberLogin, $node->NrLicencji, $node->OdpowiedzialnyNazwa, $node->OdpowiedzialnyNrLicencji, $node->Komunikator, $node->PlikFoto, $kod_pracownika, $node->DzialFunkcja);
                     array_push($all_agents_ids, (int) $node["ID"]);
                     Agents::AddEditAgent($agent);
                     echo DataBase::GetDbInstance()->LastError();
                 }
             }
             //Offers
             if ($xml2->name == "Oferty") {
                 $node = simplexml_import_dom($domdoc->importNode($xml2->expand(), true));
                 if (count($node) > 0) {
                     foreach ($node->children() as $nodeOferta) {
                         $count_arr["suma"]++;
                         $log .= "oferta=" . $nodeOferta["ID"] . " - " . $nodeOferta["Symbol"] . "\n";
                         //read major properties
                         $rent = strtolower($nodeOferta["Wynajem"]) == "true" ? 1 : 0;
                         $orig = strtolower($nodeOferta["Pierwotny"]) == "true" ? 1 : 0;
                         $przedmiot = $nodeOferta["Przedmiot"];
                         if ($przedmiot == "Biurowiec") {
                             $przedmiot = "Obiekt";
                         }
                         $first_page = strtolower($nodeOferta->PierwszaStrona) == "true" ? 1 : 0;
                         $zamiana = $nodeOferta->Zamiana ? 1 : 0;
                         $loc_as_commune = strtolower($nodeOferta["LokalizacjaJakoGmina"]) == "true" ? 1 : 0;
                         $has_swfs = 0;
                         $has_movs = 0;
                         $has_maps = 0;
                         $has_projs = 0;
                         $has_pans = 0;
                         $has_photos = 0;
                         if (isset($nodeOferta->Zdjecia)) {
                             foreach ($nodeOferta->Zdjecia->children() as $zd) {
                                 switch ($zd->typ) {
                                     case "Zdjecie":
                                         $has_photos = 1;
                                         break;
                                     case "Rzut":
                                         $has_projs = 1;
                                         break;
                                     case "Mapa":
                                         $has_maps = 1;
                                         break;
                                     case "SWF":
                                         $has_swfs = 1;
                                         break;
                                     case "Filmy":
                                         $has_movs = 1;
                                         break;
                                     case "Panorama":
                                         $has_pans = 1;
                                         break;
                                 }
                             }
                         }
                         $attr_arr = array("Link" => null, "ZeroProwizji" => 0);
                         if (isset($nodeOferta->Atrybuty)) {
                             foreach ($nodeOferta->Atrybuty->children() as $at) {
                                 if ($at["opis"] == "Link") {
                                     $attr_arr["Link"] = (string) $at;
                                 }
                                 if ($at["opis"] == "ZeroProwizji") {
                                     $attr_arr["ZeroProwizji"] = (string) $at;
                                 }
                             }
                         }
                         $offer = new Offer($nodeOferta["Jezyk"], CheckNumeric($nodeOferta["ID"]), $nodeOferta["Status"], $przedmiot, $rent, $nodeOferta["Symbol"], $orig, $nodeOferta["Wojewodztwo"], $nodeOferta["Powiat"], $nodeOferta["Lokalizacja"], $nodeOferta["Dzielnica"], $nodeOferta["Rejon"], $nodeOferta["Ulica"], $nodeOferta["Pietro"], CheckNumeric($nodeOferta["Cena"]), CheckNumeric($nodeOferta["CenaM2"]), $nodeOferta["IloscPokoi"], CheckNumeric($nodeOferta["PowierzchniaCalkowita"]), CheckNumeric($nodeOferta["MapSzerokoscGeogr"]), CheckNumeric($nodeOferta["MapDlugoscGeogr"]), $nodeOferta["TechnologiaBudowlana"], $nodeOferta["MaterialKonstrukcyjny"], $nodeOferta["StanWybudowania"], $nodeOferta["RodzajBudynku"], $nodeOferta["Agent"], $nodeOferta["DataWprowadzenia"], $nodeOferta["DataWprowadzenia"], 0, empty_to_null($nodeOferta->Kraj), $nodeOferta->IloscPieter, $nodeOferta->RokBudowy, empty_to_null($nodeOferta->RodzajDomu), $first_page, empty_to_null($nodeOferta->RodzajObiektu), empty_to_null($nodeOferta->SposobPrzyjecia), $nodeOferta->IloscOdslonWWW, null, empty_to_null($nodeOferta->StatusWlasnosci), empty_to_null($nodeOferta->UmeblowanieLista), $nodeOferta->PowierzchniaDzialki, $zamiana, empty_to_null(html_entity_decode($nodeOferta->UwagiOpis)), empty_to_null(html_entity_decode($nodeOferta->UwagiNieruchomosc)), empty_to_null($attr_arr["Link"]), $attr_arr["ZeroProwizji"], $nodeOferta["DataWaznosci"], $has_swfs, $has_movs, $has_photos, $has_pans, $has_maps, $has_projs, $loc_as_commune);
                         $photosNode = null;
                         $roomsNode = null;
                         $modDate = null;
                         $attributesNode = null;
                         $ts = microtime_float();
                         //properties that are in offers directly
                         $pomin = OffersHelper::$props_arr;
                         //atributes that are in offers directly
                         $pomin_attr = array("Link", "ZeroProwizji");
                         //read other properties
                         foreach ($nodeOferta->children() as $propNode) {
                             $pname = $propNode->getName();
                             if ($pname == "StanPrawnyDom" || $pname == "StanPrawnyGruntu" || $pname == "StanPrawnyLokal" || $pname == "StanPrawnyLokalLista") {
                                 $offer->setStanPrawny($propNode);
                             }
                             if (in_array($pname, $pomin) === false) {
                                 if ($pname == "Zdjecia") {
                                     $photosNode = $propNode;
                                 } else {
                                     if ($pname == "DataAktualizacji") {
                                         $modDate = $propNode;
                                     } else {
                                         if ($pname == "Pomieszczenia") {
                                             $roomsNode = $propNode;
                                         } else {
                                             if ($pname == "Atrybuty") {
                                                 $attributesNode = $propNode;
                                                 $set = array();
                                                 foreach ($propNode->children() as $listNode) {
                                                     if (array_search($listNode['opis'], $pomin_attr) === false) {
                                                         $set[count($set)] = $listNode['opis'] . "#|#" . $listNode;
                                                     }
                                                 }
                                                 $offer->__set($pname, $set);
                                             } else {
                                                 if ($propNode['iset'] == true) {
                                                     $set = array();
                                                     foreach ($propNode->children() as $listNode) {
                                                         $set[count($set)] = $listNode;
                                                     }
                                                     $offer->__set($pname, $set);
                                                 } else {
                                                     $offer->__set($pname, $propNode);
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                         if ($nodeOferta['NrLokalu']) {
                             $offer->__set('NrLokalu', $nodeOferta['NrLokalu']);
                         }
                         $times["read_props"] += microtime_float() - $ts;
                         $ts = microtime_float();
                         //save offer object to database
                         if ($modDate != null) {
                             $offer->SetModificationDate($modDate);
                         }
                         $ret = Offers::AddEditOffer($offer);
                         if ($ret == "A") {
                             $count_arr["dodane"]++;
                         } else {
                             if ($ret == "E") {
                                 $count_arr["zmodyfikowane"]++;
                             }
                         }
                         echo DataBase::GetDbInstance()->LastError();
                         $times["save"] += microtime_float() - $ts;
                         $ts = microtime_float();
                         //delete unuse properties from offer
                         $addedProperties = array();
                         foreach ($nodeOferta->children() as $propNode) {
                             $pname = $propNode->getName();
                             if ($pname == "StanPrawnyDom" || $pname == "StanPrawnyGruntu" || $pname == "StanPrawnyLokal" || $pname == "StanPrawnyLokalLista") {
                                 $pname = "StanPrawny";
                             }
                             if (in_array($pname, $pomin) === false) {
                                 if ($pname != "Zdjecia" && $pname != "Pomieszczenia" && $pname != "Atrybuty" && $pname != "DataAktualizacji" || $propNode['iset'] == true) {
                                     $prop = Properties::GetPropertyName($pname);
                                     if ($prop != null) {
                                         $addedProperties[count($addedProperties)] = $prop->GetID();
                                     }
                                 }
                             }
                         }
                         if ($nodeOferta['NrLokalu']) {
                             $addedProperties[] = Properties::GetPropertyName('NrLokalu')->GetID();
                         }
                         if ($attributesNode != null) {
                             $addedProperties[] = Properties::GetPropertyName($attributesNode->getName())->GetID();
                         }
                         Offers::DeleteUnUseProperties($offer->GetId(), $offer->GetIdLng(), $addedProperties);
                         $times["del_props"] += microtime_float() - $ts;
                         $ts = microtime_float();
                         //photos
                         $addedPhotos = array();
                         if ($photosNode != null) {
                             foreach ($photosNode->children() as $photoNode) {
                                 $intro = strtolower($photoNode->intro) == "true" ? 1 : 0;
                                 $photo = new OfferPhoto($photoNode['ID'], $offer->GetId(), null, $photoNode->plik, $photoNode->opis, $photoNode->lp, $photoNode->typ, $intro, $photoNode['fotoID'], (string) $photoNode->LinkFilmYouTube, (string) $photoNode->LinkMiniaturkaYouTube);
                                 OfferPhotos::AddEditPhoto($photo);
                                 echo DataBase::GetDbInstance()->LastError();
                                 $addedPhotos[count($addedPhotos)] = $photo->GetId();
                             }
                         }
                         OfferPhotos::DeleteUnUsePhotos($offer->GetId(), $addedPhotos, 0);
                         $times["photos"] += microtime_float() - $ts;
                         $ts = microtime_float();
                         //rooms
                         if ($roomsNode != null) {
                             if ($prevOfferId != $offer->GetId() . "") {
                                 OfferRooms::DeleteRooms($offer->GetId(), null);
                             }
                             $times["rooms_del"] += microtime_float() - $ts;
                             foreach ($roomsNode->children() as $roomNode) {
                                 $room = new OfferRoom(0, $offer->GetId(), $offer->GetIdLng(), $roomNode['Rodzaj'], $roomNode->Lp, $roomNode->Powierzchnia, $roomNode->Poziom, $roomNode->Typ, CheckNumeric($roomNode->Wysokosc), $roomNode->RodzajKuchni, CheckNumeric($roomNode->Ilosc), $roomNode->Glazura, $roomNode->WidokZOkna, $roomNode->Opis, $roomNode->StanPodlogi, $roomNode->RodzajPomieszczenia);
                                 //sets of properties
                                 $_floors = array();
                                 if ($roomNode->Podlogi) {
                                     foreach ($roomNode->Podlogi->children() as $listNode) {
                                         $_floors[count($_floors)] = $listNode;
                                     }
                                 }
                                 $room->SetFloors($_floors);
                                 $_windowsExhibition = array();
                                 if ($roomNode->WystawaOkien) {
                                     foreach ($roomNode->WystawaOkien->children() as $listNode) {
                                         $_windowsExhibition[count($_windowsExhibition)] = $listNode;
                                     }
                                 }
                                 $room->SetWindowsExhibition($_windowsExhibition);
                                 $_walls = array();
                                 if ($roomNode->Sciany) {
                                     foreach ($roomNode->Sciany->children() as $listNode) {
                                         $_walls[count($_walls)] = $listNode;
                                     }
                                 }
                                 $room->SetWalls($_walls);
                                 $_equipment = array();
                                 if ($roomNode->Wyposazenie) {
                                     foreach ($roomNode->Wyposazenie->children() as $listNode) {
                                         $_equipment[count($_equipment)] = $listNode;
                                     }
                                 }
                                 $room->SetEquipment($_equipment);
                                 OfferRooms::AddRoom($room);
                                 echo DataBase::GetDbInstance()->LastError();
                             }
                         }
                         $times["rooms"] += microtime_float() - $ts;
                         $prevOfferId = $offer->GetId() . "";
                     }
                 }
             }
             //Deleted offers
             if ($xml2->name == "Usuniete") {
                 $node = simplexml_import_dom($domdoc->importNode($xml2->expand(), true));
                 foreach ($node->children() as $doUsuniecia) {
                     array_push($ids_do_usuniecia_dodania, (int) $doUsuniecia["ID"]);
                 }
             }
             $xml2->read();
         }
         //Delete redundant departments
         if (!$blokuj_oddzialy) {
             Departments::DeleteRedundantDepartments($all_dept_ids);
         }
         //Delete redundant agents
         if (!$blokuj_agentow) {
             Agents::DeleteRedundantAgents($all_agents_ids);
         }
         $ts = microtime_float();
         $time_end5 = microtime_float();
         $time = $time_end5 - $time_end4;
         $times["del_offers"] += microtime_float() - $ts;
         if ($this->_DEBUG) {
             echo "Saving data to db execution time: {$time} seconds<br>";
             var_dump($times);
         }
         $xml2->close();
         Errors::LogSynchroStep('WebServiceVirgo - GetOffersPartial() done');
         return $ids_do_usuniecia_dodania;
     } catch (Exception $ex) {
         Errors::LogError("WebServiceVirgo:GetOffers", $ex->getMessage() . "; " . $ex->getTraceAsString());
         return 0;
     }
 }
Exemplo n.º 30
0
<?php

session_start();
include '../class/config.php';
include '../class/class_departments.php';
$dept = new Departments();
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $name = mysql_escape_string($_POST['name']);
    $description = mysql_escape_string($_POST['description']);
    $dept->name = $name;
    $dept->description = $description;
    $dept->departmentAdd();
}
?>

<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>E-Blast</title>

    <!-- Bootstrap Core CSS -->
    <link href="<?php 
echo $url;