Beispiel #1
0
                                </button>
                                <ul class="dropdown-menu">
                                    <li><a href="#">Canadian Dollar</a></li>
                                    <li><a href="#">Pound</a></li>
                                </ul>
                            </div>
                        </div> -->
                    </div>
                    <?php 
if (isLogin()) {
    ?>
                    <div class="col-xs-12 col-sm-7 col-md-5">
                        <div class="shop-menu pull-right">
                            <ul class="nav navbar-nav navbar-fixed">
                                <li><a href=""><i class="fa fa-user"></i> <?php 
    echo "Hi! " . getRwUsers(isLogin())->user_fullname;
    ?>
</a></li>
                                <li><a href="<?php 
    echo site_url('my-orders');
    ?>
"><i class="fa fa-shopping-cart"></i> My Orders</a></li>
                                <!-- <li><a href="#"><i class="fa fa-star"></i> Wishlist</a></li>
                                <li><a href="checkout.html"><i class="fa fa-crosshairs"></i> Checkout</a></li> -->
                                <?php 
    if (!isArvindUser() && !isBrandUser()) {
        ?>
                                <li><a href="<?php 
        echo site_url('review');
        ?>
"><i class="fa fa-eye"></i> Review </a></li>
Beispiel #2
0
/**
 * displayUsers function
 * this funciton is to renders the list of all users with fewer info, also user can be made active/ inactive or delete from the same page.
 * @return void
 * @author Ankit Balyan - sf.ankit@gmail.com
 **/
function displayUsers()
{
    $rwUsers = getRwUsers();
    if (count($rwUsers)) {
        ?>
		<table id="displayUsers" class="table table-striped">
			<thead>
				<tr>
					<th>User Id</th>
					<th>Username</th>
					<th>Full Name</th>

					<th>Email</th>
					<th>Phone</th>
					<th>Source</th>

					<th>Level</th>
					<th>Related To</th>
					<th><input type="checkbox" name="user_status_check" id="user_id_0"  class="bootstrapSwitch" ></th>
					<th>Delete</th>
				</tr>
			</thead>
			<tbody>
			<?php 
        foreach ($rwUsers as $user) {
            ?>
				<tr>
					<td><a href=""><span class="glyphicon glyphicon-edit"></span></a> <?php 
            echo $user->user_id;
            ?>
</td>
					<td><?php 
            echo $user->user_name;
            ?>
</td>
					<td><?php 
            echo $user->user_fullname;
            ?>
</td>

					<td><?php 
            echo $user->user_email;
            ?>
</td>
					<td><?php 
            echo $user->user_phone;
            ?>
</td>
					<td><?php 
            echo $user->source;
            ?>
</td>

					<td><?php 
            echo $user->lvl_name;
            ?>
</td>
					<td><?php 
            echo $user->user_parent_id ? $user->parent_user : '******';
            ?>
</td>
					<td><input type="checkbox" name="user_status_check" id="user_id_<?php 
            echo $user->user_id;
            ?>
" data-user-id="<?php 
            echo $user->user_id;
            ?>
" class="bootstrapSwitch" <?php 
            echo $user->user_actv_ind ? 'checked' : '';
            ?>
></td>
					<td><a href="javascript:void(0)" onclick="delUser(<?php 
            echo $user->user_id;
            ?>
)" ><i class="fa fa-close fa-lg"></i></a></td>
				</tr>
			<?php 
        }
        ?>
			</tbody>
		</table>

		<script>
function delUser (id) {
	jQuery.ajax({
                        type: 'POST',
                        url: ajaxurl,
                        data: {action: 'user_delete', user_id: id},
                        cache: false,
                         beforeSend:function (argument) {
                           //jQuery('.overlay').fadeIn('slow'); 
                           //jQuery('.response').fadeIn('slow').html("Processing...");
                        },
                        success: function(result) {
                           //jQuery('.response').fadeIn('slow').html(result).delay(5000).fadeOut('slow');
                           //jQuery('.overlay').delay(5100).fadeOut('slow');
                           window.location.href = window.location.href;
                        }
                    });
}

		</script>
	<?php 
    }
}
Beispiel #3
0
/**
 * confirmDistributorOrders function
 * this funciton is to confirm all the pending orders's of a particular distributir only, iff he has filled some order's quantity.
 * it also send a mail to that particular distibutor with his and his dealer's all order's report in excel format, and cc to roadshow's admin's email as well.
 * the function can be called by ajax method using action command 'confirm_dealer_orders'
 * @return void
 * @author Ankit Balyan - sf.ankit@gmail.com
 **/
function confrimDistributorOrders()
{
    global $wpdb;
    $table = 'rw_orders';
    $user_id = isset($_POST['user_id']) ? $_POST['user_id'] : isLogin();
    if ($user_id) {
        if ($dist = isDistributor()) {
            $sql = "UPDATE {$table} SET `order_confirm_ind` = '1' WHERE `created_by` = {$user_id} and `total_qty` > 0 ";
            $update = $wpdb->query($sql);
            if ($update) {
                $user = getRwUsers($user_id);
                $body = "Dear " . $user->user_name . ",<br><br>Your final order has been received,<br><br>Please find attached the details for your order.\n<br> <br> Our team will get in touch for final verification and confirmation. Meanwhile if you have any doubts, please contact our support team at arvindcare@arvindbrands.com<br><br><br>thanks and regards…";
                $mailData = array('from' => '', 'to' => isset($user->user_email) ? $user->user_email : '', 'cc' => get_option('admin_email'), 'bcc' => isset($dist[0]) ? $dist[0]->user_email : '', 'replyto' => get_option('admin_email'), 'replytoname' => 'Roadshow Admin', 'subject' => 'Order\'s Report', 'message' => $body, 'attachment' => exportXls(null, FALSE));
                echo "All Orders have been Confirmed ";
                if (rwMail($mailData)) {
                    echo " and mailed ";
                }
                echo " sucessfully";
            } else {
                echo "No update Taken place! Please Try After Some Time";
            }
        }
    }
    die;
}
Beispiel #4
0
/**
 * genxls function
 * this funciton is to genterate the excel reports, save it or download at the browser
 * @param data - array of data that is need to be write on excel file
 * @param attachment - if true force to download the excel file at browser else save it in rwFiles direcory
 * @return sting - path of file stored
 * @author Ankit Balyan - sf.ankit@gmail.com
 **/
function genxls($data = array(), $attachment = false)
{
    /** Error reporting */
    error_reporting(E_ALL);
    /** Include path **/
    //	ini_set('include_path', ini_get('include_path').';../Classes/');
    /** PHPExcel */
    include ROADSHOW . 'PHPExcel/Classes/PHPExcel.php';
    /** PHPExcel_Writer_Excel2007 */
    include ROADSHOW . 'PHPExcel/Classes/PHPExcel/Writer/Excel2007.php';
    // Create new PHPExcel object
    //echo date('H:i:s') . " Create new PHPExcel object\n";
    $objPHPExcel = new PHPExcel();
    // Set properties
    //echo date('H:i:s') . " Set properties\n";
    $objPHPExcel->getProperties()->setCreator("Ankit Balyan");
    $objPHPExcel->getProperties()->setLastModifiedBy("Ankit Balyan");
    $objPHPExcel->getProperties()->setTitle("Office 2007 XLSX Report Title");
    $objPHPExcel->getProperties()->setSubject("Office 2007 XLSX Report Subject");
    $objPHPExcel->getProperties()->setDescription("This is a testing report document.");
    // Add some data
    //echo date('H:i:s') . " Add some data\n";
    $objPHPExcel->setActiveSheetIndex(0);
    //HEre your first sheet
    $objWorkSheet = $objPHPExcel->getActiveSheet();
    $brands = $data;
    //    print_r($data);
    $i = 0;
    foreach ($brands as $key => $data) {
        if (!isArvindUser()) {
            $objPHPExcel->getActiveSheet()->SetCellValue('A2', 'Order\'s Report');
            $objPHPExcel->getActiveSheet()->SetCellValue('A3', 'Customer Name:');
            $user = getRwUsers(isLogin());
            $objPHPExcel->getActiveSheet()->SetCellValue('B3', $user->user_fullname);
            $objPHPExcel->getActiveSheet()->SetCellValue('A4', 'Date:');
            $objPHPExcel->getActiveSheet()->SetCellValue('B4', date('d M Y'));
            $rowI = 5;
        } else {
            $rowI = 1;
        }
        if ($i != 0) {
            $objWorkSheet = $objPHPExcel->createSheet($key);
        }
        //Setting index when creating
        $count = count($data);
        if ($count) {
            $colI = 0;
            foreach ($data[0] as $k => $v) {
                $colChar = PHPExcel_Cell::stringFromColumnIndex($colI++);
                $cellId = $colChar . ($rowI + 1);
                $objWorkSheet->SetCellValue($cellId, $k);
            }
            $rowI++;
            foreach ($data as $key => $row) {
                $colI = 0;
                foreach ($row as $k => $v) {
                    $colChar = PHPExcel_Cell::stringFromColumnIndex($colI++);
                    $cellId = $colChar . ($rowI + 1);
                    $objWorkSheet->SetCellValue($cellId, $v);
                }
                $rowI++;
            }
            // Rename sheet
            //	echo date('H:i:s') . " Rename sheet\n";
            $objWorkSheet->setTitle('Brand');
            $i++;
        }
    }
    // Save Excel 2007 file
    //	echo date('H:i:s') . " Write to Excel2007 format\n";
    $objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
    //$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
    $filename = "data_" . time() . ".xls";
    $DIR = $_SERVER["DOCUMENT_ROOT"] . '/rwFiles/';
    !is_dir($DIR) ? mkdir($DIR, 0777, true) : '';
    $path = $DIR . $filename;
    //$url = "http://".$_SERVER['HTTP_HOST'].'/oddpodimages/'.$filename;
    $fp = fopen($path, 'w');
    $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
    $objWriter->save($path);
    fclose($fp);
    $objPHPExcel->disconnectWorksheets();
    unset($objPHPExcel);
    if (file_exists($path) && $attachment) {
        header('Content-Description: File Transfer');
        header('Content-Transfer-Encoding: binary');
        header('Content-Disposition: attachment;filename=' . $filename);
        header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
        header('Content-Length: ' . filesize($path));
        header('Pragma: no-cache');
        header('Expires: 0');
        ob_clean();
        flush();
        @readfile($path);
        exit;
    }
    return $path;
    die;
}