コード例 #1
0
ファイル: class.order.php プロジェクト: billibrenan/database
 public function getOrderList()
 {
     // $result=DB::query("INSERT `order` SET id=4,content=777");
     $result = DB::query("SELECT order_id,content FROM `order`");
     $html = '<h2>Table of orders</h2> <table border="1">';
     while ($obj = DB::fetch_object($result)) {
         $html .= '<tr><td>' . $obj->id . '</td><td>' . $obj->content . '</td><tr>';
     }
     $html .= '</table>';
     return $html;
 }
コード例 #2
0
/**
 * upload voter lists for postal voting and for each ballot
 *
 * @param Period  $period
 * @param boolean $include_ballot_voters (optional)
 * @return boolean
 */
function upload_voters($period, $include_ballot_voters=false) {

	$data = array();

	// postal voters
	$sql = "SELECT invite FROM member
		JOIN offlinevoter ON offlinevoter.member = member.id AND offlinevoter.ballot IS NULL AND offlinevoter.period = ".intval($period->id);
	$data[0] = array(
		'name'   => "postal voting",
		'voters' => DB::fetchfieldarray($sql)
	);

	// ballot voters
	if ($include_ballot_voters) {
		$sql_ballot = "SELECT * FROM ballot WHERE period=".intval($period->id)." AND approved=TRUE";
		$result_ballot = DB::query($sql_ballot);
		while ( $ballot = DB::fetch_object($result_ballot, "Ballot") ) {
			$sql = "SELECT invite FROM member
				JOIN offlinevoter ON offlinevoter.member = member.id AND offlinevoter.ballot = ".intval($ballot->id);
			$data[$ballot->id] = array(
				'name'    => $ballot->name,
				'ngroup'  => $ballot->ngroup()->name,
				'opening' => timeformat($ballot->opening),
				'closing' => BALLOT_CLOSE_TIME,
				'agents'  => $ballot->agents,
				'voters'  => DB::fetchfieldarray($sql)
			);
		}
	}

	// TODO: For now we don't use the data.

}
コード例 #3
0
ファイル: Proposal.php プロジェクト: ppschweiz/basisentscheid
	/**
	 * display the list of drafts for the right column
	 *
	 * @param array   $proponents
	 */
	public function display_drafts_without_form(array $proponents) {
?>
<h2><?php 
echo _("Drafts");
?>
</h2>
<table class="drafts">
<?
		$sql = "SELECT * FROM draft WHERE proposal=".intval($this->id)." ORDER BY created DESC";
		$result = DB::query($sql);
		$i = DB::num_rows($result);
		$j = 0;
		while ( $draft = DB::fetch_object($result, "Draft") ) {
			// get the author's proponent name
			$author = new Member($draft->author);
			$proponent_name = "("._("proponent revoked").")";
			foreach ($proponents as $proponent) {
				if ($proponent->id == $author->id) {
					$proponent_name = $proponent->proponent_name;
					break;
				}
			}
			if ($j==0) {
				$link = "proposal.php?id=".$this->id;
			} else {
				$link = "draft.php?id=".$draft->id;
			}
?>
<tr>
	<td class="content" onClick="location.href='<?php 
echo $link;
?>
'"><?php 
echo $i;
?>
 <a href="<?php 
echo $link;
?>
"><?php 
echo datetimeformat_smart($draft->created);
?>
</a> <?php 
echo limitstr($proponent_name, 30);
?>
</td>
</tr>
<?
			$i--;
			$j++;
		}
?>
</table>
<?
	}
コード例 #4
0
ファイル: Ngroup.php プロジェクト: ppschweiz/basisentscheid
	/**
	 * display Ngroup drop down menu
	 */
	public static function display_switch() {
?>
					<form method="GET" action="<?
		switch (BN) {
			// jump to proposals list if the same page doesn't show the equivalent content in other groups
		case "proposal.php":
		case "proposal_edit.php":
		case "draft.php":
		case "vote.php":
		case "vote_result.php":
			echo "proposals.php";
			$hidden = false;
			break;
		default:
			echo BN;
			// pages with list and edit mode and content depending on the group
		case "periods.php":
		case "admin_areas.php":
			$hidden = array(
				'ngroup' => null, // remove ngroup, because the new ngroup comes from the drop down menu
				'id'     => null  // remove id to go back from edit to list mode
			);
		}
		?>">
						<select name="ngroup" onchange="this.form.submit()" tabindex="2">
<?
		if (Login::$member) {
			$sql = "SELECT ngroup.*, member FROM ngroup
			LEFT JOIN member_ngroup ON member_ngroup.ngroup = ngroup.id AND member_ngroup.member = ".intval(Login::$member->id);
		} else {
			$sql = "SELECT * FROM ngroup";
		}
		$sql .= " ORDER BY name";
		$result = DB::query($sql);
		$ngroups = array();
		while ( $ngroup = DB::fetch_object($result, "Ngroup") ) {
			$ngroups[] = $ngroup;
		}
		$ngroups = Ngroup::parent_sort_active($ngroups);
		// own ngroups
		if (Login::$member) {
?>
							<optgroup label="<?php 
echo _("own groups");
?>
">
<?
			foreach ($ngroups as $ngroup) {
				if (!$ngroup->member) continue;
				// save groups list of the logged in member
				Login::$ngroups[] = $ngroup->id;
				// use the first ngroup as default
				if ($_SESSION['ngroup']==0) $_SESSION['ngroup'] = $ngroup->id;
?>
								<option value="<?php 
echo $ngroup->id;
?>
"<?
				if ($ngroup->id==$_SESSION['ngroup']) { ?> selected class="selected"<? }
				?>>&#9670; <?php 
echo $ngroup->name;
?>
</option>
<?
			}
?>
							</optgroup>
<?
		}
		// other ngroups
?>
							<optgroup label="<?php 
echo Login::$member ? _("other groups") : _("groups");
?>
">
<?
		foreach ($ngroups as $ngroup) {
			// save list of active groups
			Ngroup::$active_ngroups[] = $ngroup->id;
			if (Login::$member and $ngroup->member) continue;
			// use the first ngroup as default
			if ($_SESSION['ngroup']==0) $_SESSION['ngroup'] = $ngroup->id;
?>
								<option value="<?php 
echo $ngroup->id;
?>
"<?
			if ($ngroup->id==$_SESSION['ngroup']) { ?> selected class="selected"<? }
			?>>&#9671; <?php 
echo $ngroup->name;
?>
</option>
<?
		}
?>
							</optgroup>
						</select>
<?
		// add the hidden fields after the drop down menu to have ngroup always in the first place of the GET parameters
		if ($hidden) URI::hidden($hidden);
?>
					</form>
<?
	}
コード例 #5
0
$sql .= $order_by;

$result = DB::query($sql);
$pager->seek($result);
$line = $pager->firstline;

// collect issues and proposals
$issues = array();
$proposals_issue = array();
$submitted_issue = array();
$period = 0;
$period_rowspan = array();
$separator_colspan = array();
$i = 0;
$i_first = 0;
while ( $issue = DB::fetch_object($result, "Issue") and $line <= $pager->lastline ) {
	$issues[] = $issue;
	list($proposals, $submitted) = $issue->proposals_list();
	$proposals_issue[] = $proposals;
	$submitted_issue[] = $submitted;
	// calculate period rowspan
	if ($period and $issue->period == $period and !Login::$admin) {
		$period_rowspan[$i] = 0;
		$period_rowspan[$i_first] += count($proposals) + 1;
		$separator_colspan[$i] = 0;
	} else {
		$period_rowspan[$i] = count($proposals);
		$separator_colspan[$i] = 1;
		$i_first = $i;
		$period = $issue->period;
	}
コード例 #6
0
ファイル: index.php プロジェクト: billibrenan/database
<?php

//error_reporting(E_ALL);
require 'class.db.php';
require 'class.order.php';
error_reporting(0);
// константы для подключени к БД
define('HOST', 'localhost');
//сервер
define('USER', 'admin');
//пользователь
define('PASSWORD', '1234');
//пароль
define('NAME_BD', 'db_example');
//база
DB::getInstance();
// инициализация экземпляра класса дл работы с БД
//свободное использование класса
//вывод таблицы продуктов
$result = DB::query("SELECT products_id,title FROM `product`");
echo '<h2>Products:</h2> <table border="1">';
while ($obj = DB::fetch_object($result)) {
    echo '<tr><td>' . $obj->id . '</td><td>' . $obj->title . '</td><tr>';
}
echo '</table>';
$order = new Order();
echo $order->getOrderList();
//попробуем создать новый экземпляр DB
echo "<span style='color:red'>";
  include"$path/header.php";
  include"$path/title.php";
  
  
 $DBVAR = new DB();
  
 
  if (isset($_GET['act']))
  {
      $query = "SELECT * FROM apl_userasetlist WHERE aset_action = 'tambahpenghapusan'";
      $result = $DBVAR->query($query);
      //print_r($query);
      if (mysql_num_rows($result))
      {
         
          while ($dataList = $DBVAR->fetch_object($result))
          {
              $dataLisrArr[] = $dataList;
              
          }
      }
      echo '<pre>';
      //print_r($dataLisrArr);
      echo '</pre>';
         $i = 0;
  
          foreach ($dataLisrArr as $key => $value)
          {
              $aset_list =  $value->aset_list;
          }
          $explode = explode (',',$aset_list);
コード例 #8
0
 * @package Basisentscheid
 */


require "inc/common_http.php";

Login::logout();


if (!empty($_REQUEST['code'])) {

	$code = $_REQUEST['code'];

	$sql = "SELECT * FROM member WHERE password_reset_code=".DB::esc($code)." AND password_reset_code_expiry > now()";
	$result = DB::query($sql);
	$member = DB::fetch_object($result, "Member");

	if (!$member) {
		warning(_("The code is invalid!"));
	}

} else {
	$code = "";
	$member = false;
}


$password = "";

if ($action) {
	switch ($action) {
コード例 #9
0
		}		
		// pr($sql);
	$dataAsetUser = $HELPER_FILTER->getAsetUser(array('Aset_ID'=>$dataImplode));
			


		}
    // pr($row); 
        ?>

    
    <?php
    
    $query_apl = "SELECT aset_list FROM apl_userasetlist WHERE aset_action = 'validasi'";
        $result_apl = $DBVAR->query($query_apl) or die ($DBVAR->error());
        $data_apl = $DBVAR->fetch_object($result_apl);
        
        $array = explode(',',$data_apl->aset_list);
        
	foreach ($array as $id)
	{
	    if ($id !='')
	    {
		$dataAsetList[] = $id;
	    }
	}
	
	if ($dataAsetList !='')
	{
	    $explode = array_unique($dataAsetList);
	}
コード例 #10
0
#!/usr/bin/php
<?
/**
 * upload lists of postal voters to the ID server share
 *
 * A final list of postal and ballot voters is sent by cron() when entering ballot preparation phase. This script here is an addition for uploading incomplete lists of postal voters earlier and send the letters in multiple batches. If just everything is sent in the end in one batch, it can not be guaranteed that the voters get their mailings in time. When sending in multiple batches, this risk only affects late members.
 *
 * to be called by a cron job about once per day
 *
 * crontab example:
 * 48 0  * * *  <path>/cli/cron_update_postal_voters.php
 *
 * @author Magnus Rosenbaum <*****@*****.**>
 * @package Basisentscheid
 */


if ( $dir = dirname($_SERVER['argv'][0]) ) chdir($dir);
const DOCROOT = "../";
require "../inc/common_cli.php";

// active between postage set and ballot preparation started
$sql_period = "SELECT * FROM period WHERE postage = TRUE AND state != 'ballot_preparation'";
$result_period = DB::query($sql_period);
while ( $period = DB::fetch_object($result_period, "Period") ) {
	/** @var $period Period */
	upload_voters($period);
}
コード例 #11
0
ファイル: Period.php プロジェクト: ppschweiz/basisentscheid
	/**
	 * assign all remaining members to their nearest ballots
	 */
	public function assign_members_to_ballots() {

		// get all approved ballots
		$sql_ballot = "SELECT * FROM ballot WHERE period=".intval($this->id)." AND approved=TRUE";
		$result_ballot = DB::query($sql_ballot);
		$ballots = array();
		while ( $ballot = DB::fetch_object($result_ballot, "Ballot") ) {
			$ballots[] = $ballot;
		}

		// If no ballots were approved at all, ballot voting just can not take place.
		if (!$ballots) return;

		// get all ngroups within the ngroup of the period
		$result = DB::query("SELECT * FROM ngroup");
		$ngroups = array();
		while ( $ngroup = DB::fetch_object($result, "Ngroup") ) $ngroups[$ngroup->id] = $ngroup;
		$period_ngroups = Ngroup::parent_sort($ngroups, $ngroups[$this->ngroup]->parent);

		// get all members, who are in the current period not assigned to a ballot yet
		$sql = "SELECT member.* FROM member
			JOIN member_ngroup ON member_ngroup.member = member.id AND member_ngroup.ngroup = ".intval($this->ngroup)."
			LEFT JOIN offlinevoter ON member.id = offlinevoter.member AND offlinevoter.period = ".intval($this->id)."
			WHERE offlinevoter.member IS NULL";
		$result = DB::query($sql);
		while ( $member = DB::fetch_object($result, "Member") ) {

			// get lowest member ngroup (within the ngroup of the period)
			$lowest_member_ngroup = $member->lowest_ngroup($period_ngroups);
			if (!$lowest_member_ngroup) {
				trigger_error("No lowest member ngroup found", E_USER_NOTICE);
				$best_ballots = $ballots;
			} else {

				// rate ballots by distance between member and ballot
				foreach ( $ballots as $ballot ) {

					$ballot_ngroup = $period_ngroups[$ballot->ngroup];
					$ballot->score = 0; // if no matching is found at all

					// climb up from the lowest ngroup of the member until the top
					$reference_member_ngroup = $lowest_member_ngroup;
					do {
						if ( self::ngroup_is_equal_or_child($ballot_ngroup, $reference_member_ngroup, $period_ngroups) ) {
							// Score depends on how far the member has to climb up, but not on how deep the ballot is from there.
							$ballot->score = $reference_member_ngroup->depth;
							break;
						}
					} while (
						$reference_member_ngroup->parent and
						$reference_member_ngroup = $period_ngroups[$reference_member_ngroup->parent] // step up to parent of member ngroup
					);

				}

				// pick ballots with highest score
				$highest_score = 0;
				$best_ballots = array();
				foreach ( $ballots as $ballot ) {
					if ($ballot->score == $highest_score) {
						$best_ballots[] = $ballot;
					} elseif ($ballot->score > $highest_score) {
						$best_ballots = array($ballot);
						$highest_score = $ballot->score;
					}
				}

			}

			// assign member to random of the best ballots
			/** @noinspection PhpUndefinedMethodInspection */
			$best_ballots[rand(0, count($best_ballots)-1)]->assign_member($member);

		}

		$this->update_voters_cache();

	}
コード例 #12
0
	/**
	 * table body
	 *
	 * overload method for line highlighting
	 *
	 * @param resource $result
	 * @param boolean $direct_edit
	 * @param boolean $show_edit_column
	 * @param integer $linescount
	 */
	protected function display_list_tbody($result, $direct_edit, $show_edit_column, $linescount) {
?>
<tbody>
<?

		if ($this->enable_pager) {

			if (!isset($_GET['page']) and isset($_GET['hl'])) {
				// go to the page with the record to be highlighted
				$line = 0;
				while ( $object = DB::fetch_object($result, $this->classname) ) {
					if ($_GET['hl']==$object->id) {
						$this->pager->page = $this->pager->page_for_line($line);
						break;
					}
					$line++;
				}
			}

			$this->pager->seek($result);
			$line = $this->pager->firstline;
		} else {
			$line = 0;
		}
		while ( $object = DB::fetch_object($result, $this->classname) and (!$this->enable_pager or $line <= $this->pager->lastline) ) {
?>
	<tr class="<?=stripes($line);
			if (isset($_GET['hl']) and $_GET['hl']==$object->id) { ?> highlight<? }
			?>">
<?

			// use the submitted values instead of the the record from the database
			if ($direct_edit and isset($this->directedit_objects[$object->id])) {
				$object = $this->directedit_objects[$object->id];
			}

			foreach ( $this->columns as $column ) {
				if (isset($column[3]) and $column[3]===false) continue;
?>
		<td<? $this->cellclass($column) ?>><?

				$method = "print_".(!empty($column[3])?$column[3]:"text");
				if (method_exists($this, $method)) {
					$this->$method(
						// parameters for print methods:
						($column[0]?$object->$column[0]:null), // 1 content
						$object,                               // 2 object
						$column,                               // 3 column description (array)
						$line,                                 // 4 line number (starting at 0)
						$linescount                            // 5 count of lines selected in the database
					);
				} else {
					$method = "dbtableadmin_".$method;
					$object->$method(
						// parameters for print methods:
						($column[0]?$object->$column[0]:null), // 1 content
						$column,                               // 2 column description (array)
						$line,                                 // 3 line number (starting at 0)
						$linescount                            // 4 count of lines selected in the database
					);
				}
				?></td>
<?
			}

			// right column for edit, delete, duplicate
			if ($show_edit_column) {
?>
		<td class="nowrap">
<?
				// edit
				if ($this->enable_edit) {
?>
			<a href="<?=URI::append(['id'=>$object->id])?>" class="iconlink"><img src="img/edit.png" width="16" height="16" <?alt(_("edit"))?>></a>
<?
				}
				// duplicate
				if ($this->enable_duplicate) {
?>
			<input type="button" value="<?=_("duplicate")?>" onclick="submit_button('duplicate', <?=$object->id?>);">
<?
				}
				// delete
				if ( $this->enable_delete_single or $this->enable_delete_checked ) {
					$this->display_list_delete($object);
				}
?>
		</td>
<?
			}

?>
	</tr>
<?
			$line++;
		} // end while

?>
</tbody>
<?
	}
コード例 #13
0
ファイル: index.php プロジェクト: ppschweiz/basisentscheid
}
?>
	</table>
</section>

<section class="ngroups">
<h2 id="ngroups"><?php 
echo _("Groups");
?>
</h2>
<table>
<?
$sql = "SELECT * FROM ngroup ORDER BY name";
$result = DB::query($sql);
$ngroups = array();
while ( $ngroup = DB::fetch_object($result, "Ngroup") ) {
	$ngroups[] = $ngroup;
}
list($ngroups) = Ngroup::parent_sort_active_tree($ngroups);
foreach ($ngroups as $ngroup) {
	/** @var Ngroup $ngroup */
	if ( in_array($ngroup->id, Login::$ngroups) ) {
?>
	<tr class="<?php 
echo stripes();
?>
 own" title="<?php 
echo _("You are member of this group.");
?>
">
<?
コード例 #14
0
ファイル: Issue.php プロジェクト: ppschweiz/basisentscheid
	/**
	 * get all voting periods to which the issue may be assigned
	 *
	 * Issues, on which the voting already started, may not be postponed anymore.
	 * Issues, which were not started debating, may only be moved into periods
	 * where the debate has not yet started. Otherwise the debate time would be
	 * shorter than for other issues.
	 *
	 * This function may not be used in tests with time_warp(), because it uses static variables!
	 *
	 * @return array list of options for drop down menu or false
	 */
	public function available_periods() {

		// find out if the state may be changed
		switch ($this->state) {
		case "entry":
			// At least one proposal has to be admitted.
			$sql = "SELECT COUNT(1) FROM proposal WHERE issue=".intval($this->id)." AND state='admitted'::proposal_state";
			if ( !DB::fetchfield($sql) ) return false;
		case "debate":
		case "preparation":

			// Issues, on which the voting already started, may not be postponed anymore.
			// Issues, which were not started debating, may only be moved into periods where the debate has not yet started. Otherwise the debate time would be shorter than for other issues.

			// read options once from the database
			static $options_all = false;
			static $options_admission = false;
			if ($options_all===false) {
				$sql_period = "SELECT *, debate > now() AS debate_not_started FROM period
					WHERE ngroup=".intval($this->area()->ngroup)."
						AND voting > now()
					ORDER BY id";
				$result_period = DB::query($sql_period);
				$options_all = array();
				$options_admission = array();
				while ( $period = DB::fetch_object($result_period, "Period") ) {
					DB::to_bool($period->debate_not_started);
					$options_all[$period->id] = $period->id.": ".$period->current_phase();
					if ($period->debate_not_started) {
						$options_admission[$period->id] = $options_all[$period->id];
					}
				}
			}

			if ($this->state=="entry") {
				return $options_admission;
			} else {
				return $options_all;
			}

		}

		return false;
	}
コード例 #15
0
/**
 * create one test case
 *
 * @param integer $case
 * @param integer $stopcase
 * @return boolean true after last case
 */
function create_case($case, $stopcase) {
	global $date, $login, $ngroup;

	$stop = 0;
	$branch = 0;
	static $branch1 = 0;
	$casedesc = $case." (".$stopcase."/".$branch1.")";
	echo "Test case ".$casedesc."\n";

	Login::$member = $login;

	// create period
	if ($stopcase == ++$stop) {
		// period without ballot voting
		$sql = "INSERT INTO period (debate, preparation, voting, ballot_assignment, ballot_preparation, counting, ballot_voting, ngroup)
		VALUES (
			now(),
			now() + interval '1 week',
			now() + interval '2 weeks',
			NULL,
			NULL,
			now() + interval '4 weeks',
			false,
			".$ngroup->id."
		)";
		DB::query($sql);
		return;
	} else {
		// period with ballot voting
		$sql = "INSERT INTO period (debate, preparation, voting, ballot_assignment, ballot_preparation, counting, ballot_voting, ngroup, postage)
		VALUES (
			now(),
			now() + interval '1 week',
			now() + interval '2 weeks',
			now() + interval '1 week',
			now() + interval '3 weeks',
			now() + interval '4 weeks',
			true,
			".$ngroup->id.",
			true
		) RETURNING id";
		$result = DB::query($sql);
		$row = DB::fetch_row($result);
		$period = new Period($row[0]);
	}

	${'branch'.++$branch.'_array'} = array(0, 5, 15);
	$ballot_count = ${'branch'.$branch.'_array'}[${'branch'.$branch}];

	for ( $i=1; $i<=$ballot_count; $i++ ) {
		// create a ballot
		$ballot = new Ballot;
		$ballot->ngroup = $ngroup->id;
		$ballot->name = "Test ballot ".$casedesc;
		$ballot->agents = "Test agents";
		$ballot->period = $period->id;
		$ballot->opening = "8:00";
		$ballot->create();
		// add participants
		for ( $j=1; $j<=$i-1; $j++ ) {
			add_participant($period, $ballot, $case, "a".$ballot_count."i".$i."j".$j);
		}
	}

	// add postal voters
	for ( $j=1; $j<=10; $j++ ) {
		add_participant($period, true, $case, "a".$ballot_count."i0j".$j);
	}

	if ($stopcase == ++$stop) return;

	// approve ballots with 10 or more participants
	$sql = "SELECT * FROM ballot WHERE period=".intval($period->id);
	$result = DB::query($sql);
	while ( $ballot = DB::fetch_object($result, "Ballot") ) {
		if ($ballot->voters < 10) continue;
		$ballot->approved = true;
		$ballot->update(["approved"]);
	}

	if ($stopcase == ++$stop) return;

	// add further participants without assigning them to ballots
	for ($i=1; $i<=100; $i++) {
		add_participant($period, null, $case, "t".$date."c".$case."i".$i);
	}

	// move to phase "ballot_assignment"
	time_warp($period, "1 week");
	cron();

	if ($stopcase == ++$stop) return;

	// move to phase "ballot_preparation"
	time_warp($period, "2 weeks");
	cron();

	// continue with next case if branches are still available
	for ($i=1; $i<=$branch; $i++) {
		if (isset(${'branch'.$i.'_array'}[++${'branch'.$i}])) {
			for ($j=1; $j<$i; $j++) ${'branch'.$j}=0;
			return true;
		}
	}

	// end of last case
	return "end";
}
                            d.NamaLokasi, d.KodePropPerMen, d.KodeKabPerMen,
                            e.KodeSatker, e.NamaSatker, e.KodeSatker, e.KodeUnit,
                            f.InfoKondisi
                            FROM Aset AS a 
                            LEFT JOIN Kelompok AS c ON a.Kelompok_ID = c.Kelompok_ID
                            LEFT JOIN Lokasi AS d ON a.Lokasi_ID = d.Lokasi_ID 
                            LEFT JOIN Satker AS e ON a.LastSatker_ID = e.Satker_ID
                            LEFT JOIN Kondisi AS f ON a.LastKondisi_ID = f.Kondisi_ID
                            WHERE a.Aset_ID = $Aset_ID LIMIT 1";
	    print_r($query);
	    $result = $DBVAR->query($query) or die($DBVAR->error());
	    $check = $DBVAR->num_rows($result);
	    
	    if ($check)
            {
                $dataArr = $DBVAR->fetch_object($result);
	    
            }
	    
	    
            
               
	//print_r($dataArr);    
            
    
        foreach ($dataArr as $key => $value)
        {
                $$key = $value;
  
            
            $noRegistrasi = $value->Pemilik.'.'.$value->KodePropPerMen.'.'.
include "../../config/config.php";
include "{$path}/header.php";
include "{$path}/title.php";
$USERAUTH = new UserAuth();
$DBVAR = new DB();
$SESSION = new Session();
$menu_id = 51;
$SessionUser = $SESSION->get_session_user();
$USERAUTH->FrontEnd_check_akses_menu($menu_id, $SessionUser);
if (isset($_POST['usul'])) {
    print_r($_POST);
    $query = "SELECT aset_list FROM apl_userasetlist WHERE aset_action = 'Pemindahtanganan' AND UserSes = '{$SessionUser['ses_uid']}' ";
    $result = $DBVAR->query($query) or die($DBVAR->error());
    $rows = $DBVAR->num_rows($result);
    if ($rows) {
        $data = $DBVAR->fetch_object($result);
        $dataList = $data->aset_list;
    } else {
        echo '<script type=text/javascript>alert("Aset belum dipindahtangankan");window.location.href="' . $url_rewrite . '/module/pemindahtanganan/daftar_pemindahtanganan_barang.php?pid=1"</script>';
    }
    $explodeList = explode(',', $dataList);
    foreach ($explodeList as $value) {
        //$$key = $value;
        $query = "SELECT a.Aset_ID, a.NamaAset, a.Kelompok_ID, a.LastSatker_ID,\n\t\t\t\t    a.Lokasi_ID, a.LastKondisi_ID, a.Persediaan, \n\t\t\t\t    a.Satuan, a.TglPerolehan, a.NilaiPerolehan,\n\t\t\t\t    a.Alamat, a.RTRW, a.Pemilik, a.Tahun, a.NomorReg,\n\t\t\t\t    c.Kelompok, c.Uraian, c.Kode,\n\t\t\t\t    d.NamaLokasi, d.KodePropPerMen, d.KodeKabPerMen,\n\t\t\t\t    e.KodeSatker, e.NamaSatker, e.KodeSatker, e.KodeUnit,\n\t\t\t\t    f.InfoKondisi\n\t\t\t\t    FROM Aset AS a \n\t\t\t\t    LEFT JOIN Kelompok AS c ON a.Kelompok_ID = c.Kelompok_ID\n\t\t\t\t    LEFT JOIN Lokasi AS d ON a.Lokasi_ID = d.Lokasi_ID \n\t\t\t\t    LEFT JOIN Satker AS e ON a.LastSatker_ID = e.Satker_ID\n\t\t\t\t    LEFT JOIN Kondisi AS f ON a.LastKondisi_ID = f.Kondisi_ID\n\t\t\t\t    WHERE a.Aset_ID = {$value}";
        print_r($query);
        $result = $DBVAR->query($query) or die($DBVAR->error());
        $data = $DBVAR->fetch_object($result);
        $dataArray[] = $data;
    }
}
$usulan_id = '';
コード例 #18
0
ファイル: ulogin.model.php プロジェクト: ulogin/ulogin-Diafan
 public function uloginLoginUser($user_id)
 {
     $result = DB::query("SELECT * FROM {users} WHERE trash='0' AND act='1' AND id='%s'", $user_id);
     $user = DB::fetch_object($result);
     DB::free_result($result);
     $this->diafan->_users->set($user);
     $this->diafan->redirect($this->diafan->_route->current_link());
 }
コード例 #19
0
ファイル: Comments.php プロジェクト: ppschweiz/basisentscheid
	/**
	 * list the child comments for one parent-comment
	 *
	 * @param mixed   $parent ID of parent comment or "pro"/"contra"/"discussion"
	 * @param integer $level  (optional) folding level, top level is 0
	 * @param boolean $full   (optional) allow showing full text
	 */
	private function display_comments($parent, $level=0, $full=true) {

		$sql = "SELECT comment.*, rating.score";
		if (Login::$member) {
			$sql .= ", seen.comment AS seen
			FROM comment
			LEFT JOIN rating ON rating.comment = comment.id AND rating.member = ".intval(Login::$member->id)."
			LEFT JOIN seen   ON seen.comment   = comment.id AND seen.member   = ".intval(Login::$member->id);
		} else {
			$sql .= "
			FROM comment
			LEFT JOIN rating ON rating.comment = comment.id AND rating.session = ".DB::esc(session_id());
		}
		// intval($parent) gives parent=0 for "pro"/"contra"/"discussion"
		$sql .= "
			WHERE proposal=".intval(self::$proposal->id)."
				AND rubric=".DB::esc($this->rubric)."
				AND parent=".intval($parent)."
			ORDER BY removed, rating DESC, created";
		$result = DB::query($sql);

		$comments = array();
		$open_ids = array();
		while ( $comment = DB::fetch_object($result, "Comment") ) {
			/** @var Comment $comment */
			$comments[] = $comment;
			if (in_array($comment->id, self::$open_ids)) $open_ids[] = $comment->id;
		}

		if (!$comments and self::$parent!=$parent) return;

?>
<ul>
<?

		$position = 1;
		$remaining = 0;
		$new       = 0;
		$highlight_started = false;
		$comments_head = self::comments_head($level);
		$open = in_array($parent, self::$open);
		foreach ( $comments as $comment ) {
			$limit_reached = $position > $comments_head;
			if (
				$limit_reached and
				!$open and
				!$open_ids // display comments until all to be open have been displayed
			) {
				$remaining++;
				if (Login::$member and !$comment->seen) $new++;
			} else {
				// highlight
				if (
					$limit_reached and
					isset($_GET['openhl']) and $_GET['openhl']==$parent and
					!$highlight_started
				) {
?>
<div id="openhl">
<?
					$highlight_started = true;
				}
				// display one comment and its children
				$this->display_comment($comment, $position, $level, $full);
				array_remove_value($open_ids, $comment->id);
			}
			$position++;
		}

		if ($highlight_started) {
?>
</div>
<?
		}

		// links to remaining comments only under fully shown comments
		if ($remaining and $full) {
			$open = self::$open;
			$show = self::$show;
			$open[] = $parent;
			$open = array_unique($open);
?>
<li><a href="<?php 
echo URI::append(['open' => $open, 'show' => $show, 'openhl' => $parent]);
?>
#openhl"><?
			if (!intval($parent)) {
				if ($this->rubric=="discussion") {
					if ($new) printf(ngettext("show remaining 1 new comment", "show remaining %d comments, %d of them new", $remaining), $remaining, $new);
					else printf(ngettext("show remaining 1 comment", "show remaining %d comments", $remaining), $remaining);
				} else {
					if ($new) printf(ngettext("show remaining 1 new argument", "show remaining %d arguments, %d of them new", $remaining), $remaining, $new);
					else printf(ngettext("show remaining 1 argument", "show remaining %d arguments", $remaining), $remaining);
				}
			} else {
				if ($position==1) {
					if ($new) printf(ngettext("show 1 new reply", "show %d replys, %d of them new", $remaining), $remaining, $new);
					else printf(ngettext("show 1 reply", "show %d replys", $remaining), $remaining);
				} else {
					if ($new) printf(ngettext("show remaining 1 new reply", "show remaining %d replys, %d of them new", $remaining), $remaining, $new);
					else printf(ngettext("show remaining 1 reply", "show remaining %d replys", $remaining), $remaining);
				}
			}
			?></a></li>
<?
		}

		if (
			isset($_GET['parent']) and $_GET['parent']==$parent and
			Login::access_allowed("comment") and
			self::$proposal->allowed_add_comments($this->rubric)
		) {
?>
<li id="form" class="anchor">
	<div class="comment">
<?
			form(URI::append(['parent'=>$parent]), "", "comment", "comment", true);
?>
<div class="time"><?
			if (intval($parent)) echo _("New reply");
			elseif ($this->rubric=="discussion") echo _("New comment");
			else echo _("New argument");
			?>:</div>
<input name="title" type="text" maxlength="<?php 
echo Comment::title_length;
?>
" value="<?php 
echo h(isset($_POST['title']) ? $_POST['title'] : "");
?>
" required><br>
<textarea name="content" rows="5" maxlength="<?php 
echo Comment::content_length;
?>
" required><?php 
echo h(isset($_POST['content']) ? $_POST['content'] : "");
?>
</textarea><br>
<input type="hidden" name="action" value="add_comment">
<input type="hidden" name="parent" value="<?php 
echo $parent;
?>
">
<input type="submit" value="<?php 
echo _("save");
?>
">
<?
			form_end();
?>
	</div>
</li>
<?
		}

?>
</ul>
<?
	}
コード例 #20
0
	}
}


if (isset($UserSession['ses_utoken']) && ($UserSession['ses_uid']))
{
	$menuID = $UserSession['ses_uhakakses'];
	
}
else
{
	
	$query = "SELECT menuID FROM tbl_user_menu WHERE menuAksesLogin = 0 AND menuStatus = 1";
	$result = $DBVAR->query($query) or die ($DBVAR->error());
	
	while ($data = $DBVAR->fetch_object($result))
	{
		$menuID[] = $data->menuID;
	}
	
	if (count($menuID) > 0)
	{
		$implode = implode(',',$menuID);
		$defaultSes = $SESSION->set_session(array('ses_name' => 'menu_without_login', 'ses_value' => $implode));	
	}
	else
	{
		$USERAUTH->show_warning('Sesi user gagal di set');
	}
	
}
コード例 #21
0
ファイル: ballots.php プロジェクト: ppschweiz/basisentscheid
$result = DB::query($sql);
$pager->seek($result);
if (!$pager->linescount) {
?>
	<tr class="td0"><td colspan="<?=$colspan?>" class="center"><?
	if ($period->state=="ballot_application") {
		echo _("There are no applications for ballots yet.");
	} else {
		echo _("There were no applications for ballots.");
	}
	?></td></tr>
<?
} else {

	$line = $pager->firstline;
	while ( $ballot = DB::fetch_object($result, "Ballot") and $line <= $pager->lastline ) {
?>
	<tr class="<?=stripes()?>">
		<td class="right"><?=$ballot->id?></td>
		<td><?=h($ballot->name)?></td>
		<td><?=$ballot->ngroup()->name?></td>
		<td class="center"><?=timeformat($ballot->opening)?> &ndash; <?=BALLOT_CLOSE_TIME?></td>
		<td><?=h($ballot->agents)?></td>
		<td class="center"><?=$ballot->voters?></td>
<?
		if ($entitled) {
?>
		<td>
<?
			/** @noinspection PhpUndefinedVariableInspection */
			if ($row_voters and $row_voters['ballot']==$ballot->id) {