text:
<repo_name>jkruse14/react-redux-todo<file_sep>/src/components/ToDoList/VisibleToDoList.spec.js
import React from 'react';
import { Provider } from 'react-redux'
import { createMockStore } from 'redux-test-utils';
import { shallow, render } from 'enzyme';
import VisibleTodoList from './VisibleToDoList.js';
import {shallowWithStore} from '../../TestUtils/TestUtils'

let testState = {
  visibilityFilter: 'SHOW_ALL',
  todos: [],
  AppData: {next_id: 0},
  modal: 'NONE'
}
let store = createMockStore(testState);

import {
  setVisibilityFilter,
  VISIBILITY_FILTERS
} from '../Filters/FiltersActions'

const { SHOW_ALL,
        SHOW_COMPLETED,
        SHOW_INCOMPLETE,
        SHOW_OVERDUE,
        HIDE_OVERDUE} = VISIBILITY_FILTERS

let todos = [];
for(let i = 0; i < 7; i++) {
  todos.push(
    {
      id:i,
      text:"test " + i,
      due_date: "2017-07-19",
      completed: i%2 === 0 ? true : false
    }
  )
}

testState.todos = todos;

let component = shallowWithStore(<VisibleTodoList />, store)
component.setState({todos: todos, visibilityFilter: store.visibilityFilter})

test('should render VisibleTodoList', () =>{
  expect(component).toBeTruthy();
})

test('Should show all todos', () => {
  expect(component.state().todos.length).toBe(7)
});

// test('Should show completed todos', () => {
//   testState.visibilityFilter = 'SHOW_COMPLETED'
//   testState.todos = todos
//   console.log(testState)
//   store = createMockStore(testState)
//   component = shallowWithStore(<VisibleTodoList />, store)
//   console.log(component.state())
//   expect(component.state().todos.length).toBe(3)
// });
<file_sep>/src/components/FiltersBar/FiltersBar.js
import React from 'react'
import {connect} from 'react-redux'
import Filter from '../Filters/Filter.js'
import { MODAL_TYPES, openModal } from '../Modals/ModalsActions'
import { Button, MenuItem, Nav, NavDropdown, NavItem } from 'react-bootstrap'
import { setVisibilityFilter, VISIBILITY_FILTERS } from '../Filters/FiltersActions'

const {ADD_TODO} = MODAL_TYPES;

let FiltersBar = ({ dispatch, onAddTodoClick, onFilterSelect, next_id }) => {
  let title = 'Select Filter'
  let filters = []
  function handleAddToDoClick(e) {
    e.preventDefault();
    onAddTodoClick(next_id);
  }

  function handleFilterSelect(eventKey, e) {
    e.preventDefault();
    onFilterSelect(eventKey)
  }

  function getFilterLabel(filter){
    return filter.toLowerCase().replace(/_/g, ' ')
  }

  filters = Object.keys(VISIBILITY_FILTERS).map(function(filter, index){
    return (
        <MenuItem key={filter} eventKey={VISIBILITY_FILTERS[filter]}>
          <Filter filter={VISIBILITY_FILTERS[filter]}>
            {getFilterLabel(VISIBILITY_FILTERS[filter])}
          </Filter>
        </MenuItem>
    )
  })

  return (

      <NavItem>
        <Button id='show-addtodo-modal'
                bsStyle='primary'
                onClick={handleAddToDoClick}>Add ToDo</Button>
      </NavItem>
      <NavDropdown title={title} id='filter-dropdown' onSelect={handleFilterSelect}>
        {filters}
      </NavDropdown>

  )
}

function mapStateToProps(state, ownProps) {
  return {
    next_id: state.next_id
  }
}

function mapDispatchToProps(dispatch,ownProps) {
  return {
    onAddTodoClick: () => {
      dispatch(openModal({type: ADD_TODO}))
    },
    onFilterSelect: (filter) => {
      dispatch(setVisibilityFilter(filter))
    }
  }
}

FiltersBar = connect(
  mapStateToProps,
  mapDispatchToProps
)(FiltersBar)

export default FiltersBar;
<file_sep>/src/components/ToDo/ToDoActions.js
import React from 'react'

export const ADD_TODO = 'ADD_TODO';
export const UPDATE_TEXT = 'UPDATE_TEXT';
export const UPDATE_DUE_DATE = 'UPDATE_DUE_DATE';
export const UPDATE_TODO  = 'UPDATE_TODO';
export const TOGGLE_TODO = 'TOGGLE_TODO';
export const DELETE_TODO = 'DELETE_TODO';

export function addTodo(text, due_date, id) {
  return {
    type: ADD_TODO,
    text,
    due_date,
    id
  }
}

export function toggleTodo(index) {
  return {
    type: TOGGLE_TODO,
    index
  }
}

export function deleteTodo(id) {
  return {
    type: DELETE_TODO,
    id
  }
}

export function updateTodo(todo) {
  return {
    type: UPDATE_TODO,
    todo
  }
}
<file_sep>/src/components/ToDo/ToDoReducers.spec.js
import { ADD_TODO,
        TOGGLE_TODO,
        UPDATE_TODO,
        DELETE_TODO} from './ToDoActions'

import {todos} from './ToDoReducers'

let state = [];
let action = {type: 'test'}

test('todos should be defined', () => {
  expect(todos).toBeDefined();
})

test('should default to an empty array', () => {
  expect(todos(state,action)).toEqual([])
})

test('should add a todo with supplied text, due_date, and completed set to false', () => {
  action = {
    type: ADD_TODO,
    text: 'test',
    due_date: '2017-07-19',
    id: 0
  }

  let expected = {
    id: 0,
    text: 'test',
    due_date: '2017-07-19',
    completed: false
  }

  state = todos(state, action)
  expect(state.length).toEqual(1)
  expect(state[0]).toEqual(expected);
})

test('should toggle the state of \'completed\' for the todo id passed to \'index\'', () => {
  state = [
    {
      id: 0,
      text: 'test',
      due_date: '2017-07-19',
      completed: false
    },{
      id: 1,
      text: 'test',
      due_date: '2017-07-19',
      completed: false
    }
  ]

  action = {
    type: TOGGLE_TODO,
    index: 0
  }

  state = todos(state, action)
  expect(state[0].completed).toBe(true);
  expect(state[1].completed).toBe(false);

  state = todos(state, action)
  expect(state[0].completed).toBe(false);
  expect(state[1].completed).toBe(false);
})

test('should update the todo text', () => {
  state = [
    {
      id: 0,
      text: 'test',
      due_date: '2017-07-19',
      completed: false
    }
  ]

  let expected = {
    id: 0,
    text: 'test updated',
    due_date: '2017-07-19',
    completed: false
  }

  action = {
    type: UPDATE_TODO,
    todo: expected
  }

  state = todos(state, action)
  expect(state[0].text).toEqual(expected.text)
})

test('should update the todo due_date', () => {
  state = [
    {
      id: 0,
      text: 'test',
      due_date: '2017-07-19',
      completed: false
    }
  ]

  let expected = {
    id: 0,
    text: 'test',
    due_date: '2017-07-20',
    completed: false
  }

  action = {
    type: UPDATE_TODO,
    todo: expected
  }

  state = todos(state, action)
  expect(state[0].due_date).toEqual(expected.due_date)
})

test('should update only one todo based on id of input todo ', () => {
  state = [
    {
      id: 0,
      text: 'test',
      due_date: '2017-07-19',
      completed: false
    },{
      id: 1,
      text: 'test one',
      due_date: '2017-07-19',
      completed: false
    }

  ]

  let expected = {
    id: 0,
    text: 'test updated',
    due_date: '2017-07-19',
    completed: false
  }

  action = {
    type: UPDATE_TODO,
    todo: expected
  }

  state = todos(state, action)
  expect(state[0].text).toEqual(expected.text)
  expect(state[1].text).toEqual('test one')
})

test('should remove one todo ', () => {
  state = [
    {
      id: 0,
      text: 'test',
      due_date: '2017-07-19',
      completed: false
    },{
      id: 1,
      text: 'test one',
      due_date: '2017-07-19',
      completed: false
    }

  ]

  action = {
    type: DELETE_TODO,
    id: 0
  }

  state = todos(state, action)
  expect(state.length).toEqual(1)
  expect(state[0].id).toEqual(1)
})
<file_sep>/src/components/Modals/ModalsActions.spec.js
import {CLOSE_MODAL,
        OPEN_MODAL,
        MODAL_TYPES,
        closeModal,
        openModal} from './ModalsActions'

test('should return an action with type CLOSE_MODAL and modal of NONE', () => {
  let expected = {
    type: CLOSE_MODAL,
    modal: MODAL_TYPES.NONE
  }

  expect(closeModal()).toEqual(expected)
})

test('shouel return action with type OPEN_MODAL and modal of ADD_TODO', () => {
  let expected = {
    type: OPEN_MODAL,
    modal: MODAL_TYPES.ADD_TODO
  }
    expect(openModal(MODAL_TYPES.ADD_TODO)).toEqual(expected);
})
<file_sep>/src/components/AppActions.js
import React from 'react'

export const INCREMENT_NEXT_ID = 'INCREMENT_NEXT_ID';

export function incrementNextId() {
  return {
    type: INCREMENT_NEXT_ID
  }
}
<file_sep>/src/components/ToDoList/ToDoList.js
import React from 'react'
import {connect} from 'react-redux'
import {Table} from 'react-bootstrap'
import PropTypes from 'prop-types'
import ToDo from '../ToDo/ToDo'

class ToDoList extends React.Component {
//= ({todos, onToDoClick, onEditClick}) => {
  constructor(props) {
    super(props)
    this.state = {
      todos: props.todos,
    }
    this.onEditClick = props.onEditClick;
    this.changeTodoStatus = props.changeTodoStatus;
  }

  componentWillReceiveProps(nextProps) {
    this.state.todos = [
      ...nextProps.todos
    ]
  }

  render(){
      return (

              Task
              Due Date
              Actions

          {this.state.todos.map((todo,i) => {
            return <ToDo key={todo.id}
                                 todo_id={todo.id}
                                 {...todo}
                                 onEditClick={() => this.onEditClick(todo.id)}
                                 changeTodoStatus={() => this.changeTodoStatus(todo.id)}></ToDo>
          })}

    )}
  }

ToDoList.PropTypes = {
  todos: PropTypes.arrayOf(
    PropTypes.shape({
      id: PropTypes.number.isRequired,
      completed: PropTypes.bool.isRequired,
      text: PropTypes.string.isRequired,
      due_date: PropTypes.string.isRequired
    }).isRequired
  ).isRequired,
  changeTodoStatus: PropTypes.func.isRequired,
  onEditClick: PropTypes.func.isRequired
}

export default ToDoList;
<file_sep>/src/actions/index.js
// import React from 'react'
//
// export const ADD_TODO = 'ADD_TODO';
// export const UPDATE_TEXT = 'UPDATE_TEXT';
// export const UPDATE_DUE_DATE = 'UPDATE_DUE_DATE';
// export const UPDATE_TODO  = 'UPDATE_TODO';
// export const TOGGLE_TODO = 'TOGGLE_TODO';
// export const DELETE_TODO = 'DELETE_TODO';
// export const SET_VISIBILITY_FILTER = 'SET_VISIBILITY_FILTER';
//
// export const VISIBILITY_FILTERS = {
//   SHOW_ALL: 'SHOW_ALL',
//   SHOW_COMPLETED: 'SHOW_COMPLETED',
//   SHOW_INCOMPLETE: 'SHOW_INCOMPLETE',
//   SHOW_OVERDUE: 'SHOW_OVERDUE',
//   HIDE_OVERDUE: 'HIDE_OVERDUE'
// }
//
//
// export function addTodo(text, due_date) {
//   return {
//     type: ADD_TODO,
//     text,
//     due_date
//   }
// }
//
//
// export function toggleTodo(index) {
//   return {
//     type: TOGGLE_TODO,
//     index
//   }
// }
//
// export function deleteTodo(index) {
//   return {
//     type: DELETE_TODO,
//     index
//   }
// }
//
// export function setVisibilityFilter(filter){
//   return {
//     type: SET_VISIBILITY_FILTER,
//     filter
//   }
// }
//
// export function updateTodo(todo) {
//   return {
//     type: UPDATE_TODO,
//     todo
//   }
// }
<file_sep>/src/components/App.js
import React from 'react'
import FiltersBar from './FiltersBar/FiltersBar.js'
import AddToDo from './AddToDo/AddToDo.js'
import VisibleToDoList from './ToDoList/VisibleToDoList.js'

const App = () => (

    <AddToDo />
    <VisibleToDoList />
    <FiltersBar />

)

export default App
<file_sep>/src/index.js
import React from 'react';
import { render } from 'react-dom'
import { Provider } from 'react-redux'
import { createStore } from 'redux';
import moment from 'moment';
import todoApp from './todoApp';
import App from './components/App.js';

import {
  addTodo,
  toggleTodo
} from './components/ToDo/ToDoActions';

import {
  setVisibilityFilter,
  VISIBILITY_FILTERS
} from './components/Filters/FiltersActions';

const { SHOW_ALL } = VISIBILITY_FILTERS;

import { incrementNextId } from './components/AppActions'

let store = createStore(todoApp, /*window.STATE_FROM_SERVER*/);

/**
Everytime state changes, log it
Note: subscribe returns a function for unregistering the listener
*/
// let unsubscribe = store.subscribe(() =>
//   console.log(store.getState())
// );

//Dispatch some events
store.dispatch(addTodo('learn about actions', moment().subtract(1, 'day').format('YYYY-MM-DD'), 0))
store.dispatch(incrementNextId());
store.dispatch(addTodo('learn about reducers', moment().format('YYYY-MM-DD'), 1))
store.dispatch(incrementNextId());
store.dispatch(addTodo('learn about store', moment().format('YYYY-MM-DD'), 2))
store.dispatch(incrementNextId());
store.dispatch(toggleTodo(0))
store.dispatch(toggleTodo(1))
store.dispatch(setVisibilityFilter(VISIBILITY_FILTERS.SHOW_COMPLETED))

//unsubscribe();

render(
    <Provider store={store}>
      <App />
    </Provider>,
    document.getElementById('root'));
<file_sep>/src/components/Filters/FiltersActions.js
export const SET_VISIBILITY_FILTER = 'SET_VISIBILITY_FILTER';

export const VISIBILITY_FILTERS = {
  SHOW_ALL: 'SHOW_ALL',
  SHOW_COMPLETED: 'SHOW_COMPLETED',
  SHOW_INCOMPLETE: 'SHOW_INCOMPLETE',
  SHOW_OVERDUE: 'SHOW_OVERDUE',
  HIDE_OVERDUE: 'HIDE_OVERDUE'
}

export function setVisibilityFilter(filter){
  return {
    type: SET_VISIBILITY_FILTER,
    filter
  }
}
<file_sep>/src/components/AddToDo/AddToDo.spec.js
import React from 'react';
import renderer from 'react-test-renderer';
import { connect } from 'react-redux'
import { ADD_TODO, addTodo } from '../ToDo/ToDoActions'
import { closeModal } from '../Modals/ModalsActions'

test()
<file_sep>/src/components/AppReducers.js
import {INCREMENT_NEXT_ID, incrementNextId} from './AppActions'

let next_id;

export function AppData(state = {next_id: 0}, action) {
  switch(action.type) {
    case INCREMENT_NEXT_ID:
      let next_id = state.next_id + 1;
      return {
        ...state,
        next_id
      };
    default:
      return state
  }
}
<file_sep>/README.md
# react-redux-todo

A simple todo-list created to learn the basics of react, jest, enzyme, and the principles of redux.

basic CRUD operations are available and filtering on completion status and due dates.

basic styling with react bootstrap
<file_sep>/src/components/Filters/FiltersReducers.spec.js
import React from 'react'

import { SET_VISIBILITY_FILTER, VISIBILITY_FILTERS } from './FiltersActions'
import { visibilityFilter } from './FiltersReducers'

let state = VISIBILITY_FILTERS.SHOW_ALL

test('should return state SHOW_ALL by default', () => {
  let action = {
    type: 'test',
    filter: 'test'
  }
  expect(visibilityFilter('',action)).toBe(VISIBILITY_FILTERS.SHOW_ALL)
})

test('should return state SHOW_ALL if filter is invalid', () => {
  let action = {
    type: SET_VISIBILITY_FILTER,
    filter: 'test'
  }
  expect(visibilityFilter('',action)).toBe(VISIBILITY_FILTERS.SHOW_ALL)
})

test('should set the visibility filter to SHOW_COMPLETED', () => {
  let action = {
    type: SET_VISIBILITY_FILTER,
    filter: VISIBILITY_FILTERS.SHOW_COMPLETED
  }
  expect(visibilityFilter(state,action))
        .toBe(VISIBILITY_FILTERS.SHOW_COMPLETED)
})

test('should set the visibility filter to SHOW_INCOMPLETE', () => {
  let action = {
    type: SET_VISIBILITY_FILTER,
    filter: VISIBILITY_FILTERS.SHOW_INCOMPLETE
  }
  expect(visibilityFilter(state,action))
        .toBe(VISIBILITY_FILTERS.SHOW_INCOMPLETE)
})

test('should set the visibility filter to SHOW_OVERDUE', () => {
  let action = {
    type: SET_VISIBILITY_FILTER,
    filter: VISIBILITY_FILTERS.SHOW_OVERDUE
  }
  expect(visibilityFilter(state,action))
        .toBe(VISIBILITY_FILTERS.SHOW_OVERDUE)
})

test('should set the visibility filter to HIDE_OVERDUE', () => {
  let action = {
    type: SET_VISIBILITY_FILTER,
    filter: VISIBILITY_FILTERS.HIDE_OVERDUE
  }
  expect(visibilityFilter(state,action))
        .toBe(VISIBILITY_FILTERS.HIDE_OVERDUE)
})
<file_sep>/src/components/ToDoList/VisibleToDoList.js
import { connect } from 'react-redux'
import moment from 'moment'
import ToDoList from './ToDoList.js'
import { toggleTodo } from '../ToDo/ToDoActions.js'
import { MODAL_TYPES, openModal } from '../Modals/ModalsActions'

import {
  setVisibilityFilter,
  VISIBILITY_FILTERS
} from '../Filters/FiltersActions'

const { SHOW_ALL,
        SHOW_COMPLETED,
        SHOW_INCOMPLETE,
        SHOW_OVERDUE,
        HIDE_OVERDUE} = VISIBILITY_FILTERS

const { UPDATE_TODO } = MODAL_TYPES

const today = moment();

function getVisibleTodos(todos, filter) {
  switch(filter) {
    case SHOW_ALL:
      return todos
    case SHOW_COMPLETED:
      return todos.filter(t => t.completed === true)
    case SHOW_INCOMPLETE:
      return todos.filter(t => { return t.completed === false })
    case SHOW_OVERDUE:
      return todos.filter( t => { return moment(t.due_date) < today})
    case HIDE_OVERDUE:
      return todos.filter( t => { return moment(t.due_date).startOf('day') >= today.startOf('day') })
    default:
      return todos;
  }
}

function mapStateToProps(state) {
  return {
    todos: getVisibleTodos(state.todos, state.visibilityFilter)
  }
}

function mapDispatchToProps(dispatch) {
  return {

  }
}

const VisibleToDoList = connect(
  mapStateToProps,
  mapDispatchToProps,
)(ToDoList)

export default VisibleToDoList

languages: Markdown JavaScript


text:
<file_sep>import React from 'react';
import ReactTextTransition, { presets } from "react-text-transition";
import {Carousel, Button,Alert} from 'react-bootstrap';
import 'bootstrap/dist/css/bootstrap.min.css';
import '../css/priApp.css';
import '../css/land_dark.css';
import '../css/land_res_phn.css';
import fea1 from  '../../assets/svg/fea1.svg';
import fea2 from  '../../assets/svg/fea2.svg';
import fea3 from  '../../assets/svg/fea3.svg';
import fea4 from  '../../assets/svg/fea4.svg';
import homegit from '../../assets/svg/homegit.svg';
import homeiphone from  '../../assets/svg/iphone.svg';
import Fade from 'react-reveal/Fade';
import face_log from '../../assets/logo_facebook.svg';
import gog_log from '../../assets/logo_twitter.svg';
import link_log from '../../assets/logo_link.svg';
import * as emailjs from 'emailjs-com'
import support_ico from '../../assets/svg/support.svg';
import and1 from '../../assets/and1.png';
import int_log from '../../assets/logo_inst.svg';
import up_arrow from '../../assets/svg/up_arrow.svg';
import menu_ico from '../../assets/svg/menu.svg';
import mail_ico from '../../assets/svg/mail_outline.svg';
import call_ico from '../../assets/svg/call.svg';
import test_co from '../../assets/test_co.png';
import sal2 from '../../assets/sal2.png';
import sal3 from '../../assets/sal3.png';
import sal4 from '../../assets/sal4.png';
import sal5 from '../../assets/sal5.png';
import { slide as Menu } from 'react-burger-menu'
import { Controller, Scene } from 'react-scrollmagic';
import { Tween, Timeline } from 'react-gsap';
import history from '../home/history';
import styled from 'styled-components';

const SectionWipes2Styled = styled.div`
  overflow: hidden;
  #pinContainer {
    height: 100vh;
    width: 100vw;
    overflow: hidden;
  }
  #pinContainer .panel {
    height: 100vh;
    width: 100vw;
    position: absolute;
    text-align: center;
  }
  .panel span {
    position: relative;
    display: block;
    top: 50%;
    font-size: 80px;
  }

  .panel.blue {
    background-color: #000000;
  }

  .panel.turqoise {
    background-color: #000000;
  }

  .panel.green {
    background-color: #000000;
  }

`;

const texts = ["Mobile", "Web"];

export default class LandClass extends React.Component{

     constructor(props){
        super(props);
        this.state = {
            isLogged:true,
            isDark:false,
            logedUserId:null,
            currSite:0,
            theposition: window.pageYOffset,
            windowWidth: window.innerWidth,
            titletext:'Java',
            feedname:'',
            feedemail:'',
            feedcompany:'',
            feedquery:'',
            feederrcode:0,
            textIndex: 0,
            feederr:'Empty Error'
          }
          this.querySubmit = this.querySubmit.bind(this);
          this.listenToScroll = this.listenToScroll.bind(this);

          this.listenToScroll();
}

     routeChange = () =>{
     let path = `3000:/contact`;
     history.push(path);
     window.location.reload();
   }

  handleResize = (e) => {
  this.setState({ windowWidth: window.innerWidth });
 };
 componentWillUnmount() {
  window.addEventListener("resize", this.handleResize);
  window.removeEventListener('scroll', this.listenToScroll)
}

 componentDidMount() {

  window.addEventListener("resize", this.handleResize);
     window.addEventListener('scroll', this.listenToScroll);
     setInterval(() => {
          this.setState({
            textIndex: this.state.textIndex + 1,
          });
        },2000);
   }

   listenToScroll = () => {
     const winScroll =
       document.body.scrollTop || document.documentElement.scrollTop

     const height =
       document.documentElement.scrollHeight -
       document.documentElement.clientHeight

     const scrolled = winScroll / height

     this.setState({
       theposition: scrolled,
     })
   }

   querySubmit(e){
     e.preventDefault();
     if(this.state.feedname===''||this.state.feedname===null){
          this.setState({feederrcode:1,feederr:'Enter name'})
          console.log("Detail EMPT");
          return;
     }
     if(this.state.feedemail===''||this.state.feedemail===null){
          this.setState({feederrcode:1,feederr:'Enter email address'})
          console.log("Detail EMPT");
          return;
     }
     if(this.state.feedquery===''||this.state.feedquery===null){
          this.setState({feederrcode:1,feederr:'Enter your query'})
          console.log("Detail EMPT");
          return;
     }
     console.log(this.state.feedcompany+" "+this.state.feedname+" "+this.state.feedemail);
     let templateParams = {
          name:this.state.feedname,
          from_name: this.state.feedemail,
          to_name: '<EMAIL>',
          subject: "Cytescale Query",
          company: this.state.feedcompany,
          message: this.state.feedquery,
         }
         emailjs.send(
          'odin_email',
          'template_tisfxse',
           templateParams,
          'user_pG1FPpxntH0JfibLEaJWt'
         );
      this.resetForm()
   }

   resetForm() {
     this.setState({
          feedname: '',
       feedemail: '',
       feedcompany: '',
       feedquery: '',
     })
   }

   handleQueryChange = (param, e) => {
     this.setState({ [param]: e.target.value })
   }

    render(){

     const home_ref = React.createRef();
     const contact_ref = React.createRef();
     const what_ref = React.createRef();
     const query_ref = React.createRef();

     const height =
     document.documentElement.scrollHeight -
     document.documentElement.clientHeight;

     function scrollContact(){
          contact_ref.current.scrollIntoView({
               behavior: 'smooth',
               block: 'start',
             });
           }
           function scrollHome(){
               home_ref.current.scrollIntoView({
                    behavior: 'smooth',
                    block: 'start',
                  });
                }
                function scrollWhat(){
                    what_ref.current.scrollIntoView({
                         behavior: 'smooth',
                         block: 'start',
                       });
                     }
                     function scrollQuery(){
                         query_ref.current.scrollIntoView({
                              behavior: 'smooth',
                              block: 'start',
                            });
                          }
         var setWid = (this.state.theposition*100)+"%";
        return(

          {this.state.windowWidth<850?this.state.theposition>0.02?

::}
          {this.state.theposition>0.02?

                                   {this.state.windowWidth<850?
                                                       <Menu id='menu' width={ '90%' }  customBurgerIcon={  } >
                                                       Home
                                                       What We Do?
                                                       Query
                                                       </Menu>:
                                                       }

Cytescale

Home

What we do?

Query

:}

                              {this.state.windowWidth>850?

                                                            Cytescale

:

Cytescale

}

                                                            We Code

                                                            <ReactTextTransition
                                                            text={texts[this.state.textIndex % texts.length]}
                                                            spring={presets.gentle}
                                                            direction="down"

                                                            className="lmt_anim_txt"
                                                            delay={2000}
                                                            inline
                                                            />

                                                            Frontend

                              We bring your Design Vision into Reality with advanced Front-end Solutions {this.state.windowWidth>850?

:} in Java native, React native or as you prefer.

Scroll Down

Scroll  Down

               {this.state.windowWidth>850?:}

                                                       We make your life easier!

                                                       We transform your beautiful designs into lines of code

                                                       offering your absolute control over your frontend, pixel-perfect UI

                                                       and Flexible code. Decreasing your developmental time by nearly 50%

                                                       with Flexible pricing and much more.

                                             Wide range of choice

                                        Designs in every format are accepted. Photoshop, Figma, Adobe XD you name it!
                                        Submit the design and sit back to see it in action.

                                             Trackable Orders

                                             Updates of your order will be uploaded on GitHub repositories frequently during the project.
                                             Easy development tracking, right?

                                             24/7 Chat Support

                                             Chat with our supportive development team.
                                             Discuss any last minute changes, we will sort it out. Once we are on board together, contact us any time you want.

                                             Fast and Reliable Delivery

                                             Orders will be completed till the estimated time of completion.
                                             Our deadlines are short, strict and well thought of. No misses!

Get in touch

                                   Do not hesitate to book a call with us if you are in a spot of getting us on board. Let’s get talking!

Also, if you have any queries with the pricing structure, reach out to us. We constantly have a lot of benefits in the cost structure for students, teams and businesses.

Drop us a mail, and we will carry it further from there.

  Mail Us <a id='app_land_stack_11_rgt_high_lnk' href='mailto:<EMAIL>'><EMAIL>

  Call on{this.state.windowWidth<850?

:} +918668752239

Also,

We offer you real-time order tracking that lets you keep us in check!

                    <Carousel id='car' controls={false}>
                         <Carousel.Item id='carIte'>

                         <Carousel.Caption id='carcap' >

Git Hub Updates

GitHub repositories are updated constantly to let you access of the development process.

                         </Carousel.Caption>
                         </Carousel.Item>
                         </Carousel>

                         <svg className='app_land_stack_14_lft_tit_ico' viewBox='0 0 512 512'><title>Logo Android</title><path fill='currentColor' d='M380.91 199l42.47-73.57a8.63 8.63 0 00-3.12-11.76 8.52 8.52 0 00-11.71 3.12l-43 74.52c-32.83-15-69.78-23.35-109.52-23.35s-76.69 8.36-109.52 23.35l-43-74.52a8.6 8.6 0 10-14.88 8.64L131 199C57.8 238.64 8.19 312.77 0 399.55h512c-8.19-86.78-57.8-160.91-131.09-200.55zM138.45 327.65a21.46 21.46 0 1121.46-21.46 21.47 21.47 0 01-21.46 21.46zm235 0A21.46 21.46 0 11395 306.19a21.47 21.47 0 01-21.51 21.46z'/></svg>
                         Android Frontend

                    We provide Android Front-end Solutions with Flexible Code and Scalable Architecture,
                    in various Frameworks like Java native and React native.

               <Fade left>

                        Designs

to

Reality

in

Flexible

Code

               </Fade>
                    <Fade right>

               </Fade>

          {this.state.windowWidth>850?
          <Controller><Scene
        triggerHook="onLeave"
        duration="100%"
        pin>
        <Timeline
          wrapper={
}
        >
          <Tween
            from={{padding: '84px',borderRadius:'32px' }}
            to={{ padding: '0px' ,borderRadius:'0px',ease: "Power4.easeOut"}}
          >

                    Stay ahead of competition

               </Tween></Timeline></Scene></Controller>
               :

                                   Stay ahead of competition

               }

                         Low Pricing

                         By reducing your Work by 50%, we can literally give you a Headstart in your Tech journey for

                              Essential

                              For single layout projects

                              Made for single layout
                              Android application or website.

Eg: porfolios, blogs, etc.

                              27$

                                   Get Now !

                              Pro

                              For multi layout projects

                              Made for multi layout
                              Android applications or websites with
                              industry standard code and dedicated support.

                              97$

                                   Get Now !

                                   Business

                              For Complex projects

                                   Made for complicated projects
                                   for agencies and companies,
                                   working closely with teams.

                              Contact Us

          <SectionWipes2Styled>
    <Controller>
      <Scene
        triggerHook="onLeave"
        duration="300%"
        pin
      >
        <Timeline
          wrapper={
}
        >

                    Make your move...

          <Tween
            from={{ x: '-100%' }}
            to={{ x: '0%' }}
          >

                    Level-up digitally

          </Tween>
          <Tween
            from={{ x: '100%' }}
            to={{ x: '0%' }}
          >

                       Best-in-class Support

                    "We will be readily available to be in touch with you throughout the development days
                    (even after that, if a need occurs).
                    Our team is well-equipped to solve all your queries in absolutely no time.
                    Got an issue? Consider it solved, we will be just a call away!
                    You could contact us without hesitation.
                    The Responsive support from our side is what our customers like the most."

Mail -- Chat -- Call

          </Tween>
          <Tween
            from={{ y: '-100%' }}
            to={{ y: '0%' }}
          >

Got any

 questions for us?

Submit a query here or say hi : <EMAIL>

                                      <form onSubmit={this.querySubmit}>

Full Name*

                                      <input type='text' placeholder='Enter full name'     value={this.state.feedname}  onChange={this.handleQueryChange.bind(this, 'feedname')} className='app_setting_main_bdy_tit_main_sub_opt_cont_data'></input>

Email Address*

                                      <input type='text' placeholder='Enter email address' value={this.state.feedemail} onChange={this.handleQueryChange.bind(this, 'feedemail')} className='app_setting_main_bdy_tit_main_sub_opt_cont_data'></input>

Company Name

                                      <input type='text' placeholder='Enter company name if any' value={this.state.feedcompany} onChange={this.handleQueryChange.bind(this, 'feedcompany')}  className='app_setting_main_bdy_tit_main_sub_opt_cont_data'></input>

Query*

                                           <textarea id='app_land_stack_5_rgt_cont_txt' value={this.state.feedquery} onChange={this.handleQueryChange.bind(this, 'feedquery')}></textarea>

                                           {
                                           this.state.feederrcode===1?
                                           <Alert variant='danger'>
                                           {this.state.feederr}
                                           </Alert>:
                                           }

                                           <Button variant='success' type='submit' className='app_land_stack_5_rgt_cont_form_cont_sub_butt'>Submit</Button>
                                           </form>

          </Tween>
        </Timeline>
      </Scene>
    </Controller>
  </SectionWipes2Styled>

FAQ

1. What is the estimated time to get the project done?

                                                  Depending on the scale of the project, the time may vary. As a team,
                                                  we are absolutely on our toes to get the project to its destination with industry-standard quality.
                                                  Roughly, we asssure you maximum 15 days of persistent work and completion of project.
                                                  Trust us, we never miss our deadlines!

2. How does order tracking exactly work?

                                                  We keep you updated at every major/minor updates on E-mail, Github or the way you prefer.
                                                  The development process is completely transparent and you can ask for any queries to the development team,
                                                  we are readily available to respond on the go.

3. How to make a order?

                                                                                a) Send us an email which you'll find here.
                                                                                Let's get talking!

                                                                                b) Submit your designs by attaching them to the mail.

                                                                                c) Make the Payment.

                                                                                d) Done!

4. What if I need a fully functional Website/App?

 We primarily offer Frontend solutions. But, if you just have an idea and
                                                                                you want a complete app/website done, ask us for the details and we might have
                                                                                something in the bag for you.
                                                                                In a scenario, where you want designs, frontend and backend of a website or an app, contact us and
                                                                                lets see what we can do for you.

               We handcrafted this website with Pride and Love ♥

                              "We assure you best-in-class services
                              from our end. No compromises."

                              <NAME>

                              Co-founder

);
     }
}
<file_sep>import React, { useRef } from 'react';
import '../css/priApp.css';
import '../css/land_dark.css';
import '../css/contact.css';
import {Accordion,Card,Popover,OverlayTrigger,Carousel, Button,Alert,DropdownButton,Dropdown} from 'react-bootstrap';
import * as emailjs from 'emailjs-com'

export default class ContactClass extends React.Component{

     constructor(props){
        super(props);
        this.state = {
          feedname:'',
          feedemail:'',
          feedphone:'',
          feedcompany:'',
          feedquery:'',
          feederrcode:0,
          textIndex: 0,
          feederr:'Empty Error',
          feedsucc:'Received, We will get back to you soon!'
        }
        this.querySubmit = this.querySubmit.bind(this);
     }

     querySubmit(e){
          e.preventDefault();
          if(this.state.feedname===''||this.state.feedname===null){
               this.setState({feederrcode:1,feederr:'Enter name'})
               console.log("Detail EMPT");
               return;
          }
          if(this.state.feedemail===''||this.state.feedemail===null){
               this.setState({feederrcode:1,feederr:'Enter email address'})
               console.log("Detail EMPT");
               return;
          }
          if(this.state.feedquery===''||this.state.feedquery===null){
               this.setState({feederrcode:1,feederr:'Enter your query'})
               console.log("Detail EMPT");
               return;
          }
          console.log(this.state.feedcompany+" "+this.state.feedname+" "+this.state.feedemail);
          let templateParams = {
               name:this.state.feedname,
               from_name: this.state.feedemail,
               to_name: '<EMAIL>',
               subject: "Cytescale Query",
               company: this.state.feedcompany,
               message: "PHONE NUMBER="+this.state.feedphone+" MESSAGE="+this.state.feedquery,
              }
              emailjs.send(
               'odin_email',
               'template_tisfxse',
                templateParams,
               'user_pG1FPpxntH0JfibLEaJWt'
              );
          this.setState({feederrcode:2});
           this.resetForm()
        }

        resetForm() {
          this.setState({
               feedname: '',
            feedemail: '',
            feedcompany: '',
            feedquery: '',
            feedphone:'',
          })
        }
   handleQueryChange = (param, e) => {
     this.setState({ [param]: e.target.value })
   }

     render(){
     return(
          <>

                              Cytescale

Contact Form

                         <form id='app_contact_bdy_form_bas_cont' onSubmit={this.querySubmit}>

Your name*

                         <input type="text"    value={this.state.feedname}  onChange={this.handleQueryChange.bind(this, 'feedname')}  className='app_contact_form_txt_class'></input>

Email Address*

                         <input  type="email"  value={this.state.feedemail} onChange={this.handleQueryChange.bind(this, 'feedemail')} className='app_contact_form_txt_class'></input>

Phone Number

                         <input  type="number"  value={this.state.feedphone} onChange={this.handleQueryChange.bind(this, 'feedphone')}  className='app_contact_form_txt_class'></input>

                         {/* <DropdownButton id="dropdown-basic-button" variant='light' title="What you are interested in?">
                         <Dropdown.Item id='dropdown-basic-item' href="#">Action</Dropdown.Item>
                         <Dropdown.Item href="#">Another action</Dropdown.Item>
                         <Dropdown.Item href="#">Something else</Dropdown.Item>
                         </DropdownButton>
                          */}

Your Message*

                         <textarea placeholder='Write your message'  value={this.state.feedquery} onChange={this.handleQueryChange.bind(this, 'feedquery')} id='app_contact_form_txt_class_mes'></textarea>

                                              {
                                           this.state.feederrcode===1?
                                           <Alert variant='danger' id='cont_sub_cont_err'>
                                           {this.state.feederr}
                                           </Alert>:
                                           }
                                              {
                                           this.state.feederrcode===2?
                                           <Alert variant='success'  id='cont_sub_cont_err'>
                                           {this.state.feedsucc}
                                           </Alert>:
                                           }
                                             <button type="submit" id='app_cont_sub_butt'>Submit</button>

                         </form>

          </>
     )
     }
}<file_sep>import React, { Component } from "react";
import { Router, Switch, Route,Redirect  } from "react-router";
import history from '../home/history';
import LandPage from '../land/land.js';
import ContactPage  from '../contact/contact.js';
import Cookies from 'universal-cookie';
const cookies = new Cookies();

export default class Routers extends React.Component {
    constructor(props){
        super(props)
        this.state = {
            isLogged:false,
            uid:null
        }
        this.isAuth = this.isAuth.bind(this);

    }

    isAuth(){
        var data=cookies.get('user_token');
        if(data===null||data===undefined||data===""){
            this.setState({isLogged:false});
        }else{
            this.setState({isLogged:true});
        }
        console.log("INIT LOGIN CHECK WITH "+data);
    }
    componentDidMount() {
        this.isAuth();
    }
    setLoggedIn(res_bool,got_uid){
            this.setState({isLogged:res_bool,uid:got_uid});
    }

    render() {
        console.log("ISLOGEd"+this.state.isLogged);
        return (
            <Router history={history}>
                <Switch>
                    <Route exact path="/" >
                    <LandPage></LandPage>
                    </Route>
                    {/* <Route exact path="/land" >
                    <LandPage2></LandPage2>
                    </Route> */}
                    <Route path="/contact">
                   <ContactPage {...this.props}/>
                    </Route>
                </Switch>
            </Router>
        )
    }
}

branch_name: refs/heads/master

repo_language: JavaScript

repo_name: Cytescale/odiin-front


text:
<repo_name>SleepyFalcon/Skool<file_sep>/src/main/java/com/SKOOL/controller/StudentResource.java
package com.SKOOL.controller;

import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;

import javax.persistence.EntityExistsException;
import javax.persistence.EntityNotFoundException;

import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.SKOOL.model.Student;
import com.SKOOL.service.StudentService;

@RestController
@RequestMapping("/api")
public class StudentResource {

	private StudentService studentService;

	public StudentResource(StudentService studentService) {
		this.studentService = studentService;
	}

	@RequestMapping(value = "student", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
	public List<Student> getAllStudents() {
		return studentService.findAll();
	}

	@RequestMapping( value = "student", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<Student> createStudent( @RequestBody Student student) throws URISyntaxException {
		try {
			Student result = studentService.save(student);
			return ResponseEntity.created(new URI("/api/student/" + result.getId())).body(result);
		} catch (EntityExistsException e) {
			return new ResponseEntity<Student>(HttpStatus.CONFLICT);
		}
	}

	@RequestMapping(value = "student", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<Student> updateStudent(@RequestBody Student student) throws URISyntaxException {
		if (student.getId() == null) {
			return new ResponseEntity<Student>(HttpStatus.NOT_FOUND);
		}

		try {
			Student result = studentService.update(student);

			return ResponseEntity.created(new URI("/api/student/" + result.getId())).body(result);
		} catch (EntityNotFoundException e) {
			return new ResponseEntity<Student>(HttpStatus.NOT_FOUND);
		}
	}

	@RequestMapping(value = "/student/{id}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
	public ResponseEntity<Void> deleteStudent(@PathVariable Integer id) {
		studentService.delete(id);

		return ResponseEntity.ok().build();
	}
}

repo_language: Java

repo_name: SleepyFalcon/Skool


text:
<file_sep>

<form>
Equipment Name :
<input type ="text" name = "equip_name">

Equiment ID :
<input type ="text" name = "equip_id">

Description :
<textarea row ="5" cols ="20" name ="description">
</textarea>

Upload Image :&nbsp &nbsp &nbsp
<input type ="file" name = "upload_image" >

<input type ="submit" value = "Submit">
</form>

 <file_sep><?php
//class of users
class users{
private $_db;

 public function __construct($db=NULL)
    {
        if(is_object($db))
        {
            $this->_db = $db;
        }
        else
        {
            $dsn = "mysql:host=".DB_HOST.";dbname=".DB_NAME;
            $this->_db = new PDO($dsn, DB_USER, DB_PASS);
        }
    }

 public function createAccount()
    {
		$username=$_POST['username'];
		$password=$_POST['<PASSWORD>'];
		$rollno=$_POST['rollno'];
		$email=$_POST['email'];
        $sql = "SELECT COUNT (username) AS theCount
                FROM users
                WHERE Username=:user";
        if($stmt = $this->_db->prepare($sql)) {
            $stmt->bindParam(":user", $username, PDO::PARAM_STR);
            try{$stmt->execute();} catch(PDOException $e) {echo "
ERROR: ".$e->getMessage()."
";}
            $row = $stmt->fetch();
            if($row['theCount']!=0) {
                return "
 Error
"
                    . "
 Sorry, that username is already in use. "
                    . "Please try again.
";
            }
            /*if(!$this->sendVerificationEmail($u, $v)) {
                return "

 Error
"
                    . "
 There was an error sending your"
                    . " verification email. Please "
                    . "<a href="mailto:<EMAIL>">contact "
                    . "us for support. We apologize for the "
                    . "inconvenience.

";
            }*/
            $stmt->closeCursor();
        }

        $sql = "INSERT INTO addusers(name, password, email, rollno)
                VALUES(:user, :pass, :email,:rollno)";
        if($stmt = $this->_db->prepare($sql)) {
            $stmt->bindParam(":user", $username, PDO::PARAM_STR);
			$stmt->bindParam(":email", $email, PDO::PARAM_STR);
            $stmt->bindParam(":pass", $password, PDO::PARAM_STR);
			$stmt->bindParam(":rollno", $rollno, PDO::PARAM_STR);
			//$stmt->bindParam(":tempaddress", $password, PDO::PARAM_STR);		--tempaddress
			//$stmt->bindParam(":peraddress", $password, PDO::PARAM_STR);		--peraddress, photo,phoneno
            try{$stmt->execute();} catch(PDOException $e) {echo "
".$e->getMessage()."
";}
            $stmt->closeCursor();
            return "
 Success!
"
                    . "
 Your request for account has been added"
                    . "with the username $username."
                    . "Your account will be activated when the admin accepts your request";
            }
        else {
            return "
 Error

 Couldn't insert the "
                . "user information into the database.
";
        }
    }
}

?><file_sep><!DOCTYPE php>
<?php include_once("/common/base.php");?>
<?php include_once("/common/head.php");?>
<?php include_once("/common/navbar_top_side.php");?>

                            Equipments

                                 Click at the links below to get the ful description of the equipment
								<button type="button" class="close" data-dismiss="alert" aria-hidden="true">
								×
								</button>

EquipmentName1

                      Description..............................................................

EquipmentName2

                      Description..............................................................

EquipmentName2

                      Description..............................................................

EquipmentName1

                      Description..............................................................

EquipmentName2

                      Description..............................................................

EquipmentName2

                      Description..............................................................

    <?php include_once("/common/close.php")?><file_sep><?php

require '/inc/core.inc.php';
require '/inc/connect.inc.php';
if(isset($_SESSION['user_id'])&&!empty($_SESSION['user_id']))
{   $user_id=$_SESSION['user_id'];
    $temp=$user_id['id'];

	if( isset($_POST['new_username'])){
echo "hello";
$n_username=$_POST['new_username'];
				if(!empty($n_username))
				{
				  $name=$n_username;
				  $id=$temp;
				  $sql = "update users set name=? where id=?";
				  $query = $db->prepare($sql);
				  $query->execute(array($name,$id));
				  header('Location:settings.php');

				}
				else{
						  echo'

				 ';
				}

	}
	else{
						  echo'

				 ';
				}

	include_once("/common/head.php");
       include_once("/common/navbar_top_side.php");

?>

                <form action="editname.php" method="POST">

    					New Username
    					<input type="Username" class="form-control" id="new_username" placeholder="Enter the new username">

					<button type="submit" class="btn btn-default">Submit</button>
				 </form>

        ';

<?php    include_once("/common/close.php");
}

else{
  include 'index.php';
}
?><file_sep><?php

require_once '/inc/core.inc.php';
include_once ("/common/head.php");
if(isset($_SESSION['usertype'])&&isset($_SESSION['user_id'])){
	if($_SESSION['usertype']=='admin'){
include_once ("/common/navbar_top_side.php");
?>

All Users

<?php
			$sql= "select * from users";
			$stmt=$db->prepare($sql);
			$qresult=$stmt->execute();
			if(!$qresult)
			{
				echo "Can't fetch the records";
			}

			echo '

ID	Name	Address	Email	Phone
';
			while ($results =$stmt->fetch()){

			$id=$results['rollno'];
			$name=$results['name'];
			$address=$results['tempaddress'];
			$email=$results['email'];
			$phone=$results['phoneno'];
			//$img=$results['img'];
			?>

			<?php
					echo '
'.$id.'	'.$name.'	'.$address.'	'.$email.'	'.$phone.'
';
			?>

		<?php } ?>

<?php		}
	}
include_once("/common/close.php");
?><file_sep><!DOCTYPE php>
<?php include_once("/common/base.php");
	if(isset($_SESSION['user_id'])&&!empty($_SESSION['user_id'])){
?>
<?php include_once("/common/head.php");?>
<?php include_once("/common/navbar_top_side.php");
if(isset($_POST['eid']))
	{$_SESSION['eid']=$_POST['eid'];}
if(!isset($_POST['ename']))
	$ename=$_SESSION['ename'];
else
	{
	$ename=$_POST['ename'];
	$_SESSION['ename']=$ename;
	}
?>

<?php echo $ename ?>

						<button class="btn btn-primary" data-calendar-nav="prev"><< Prev</button>
						<button class="btn" data-calendar-nav="today">Today</button>
						<button class="btn btn-primary" data-calendar-nav="next">Next >></button>

						<button class="btn btn-warning" data-calendar-view="year">Year</button>
						<button class="btn btn-warning active" data-calendar-view="month">Month</button>
						<button class="btn btn-warning" data-calendar-view="week">Week</button>
						<button class="btn btn-warning" data-calendar-view="day-manish">Day</button>

<?php include_once("/common/close.php");
}else
{
header("login.php");
}

?><file_sep><?php
//class of users
class equipment{
private $_db;

 public function __construct($db=NULL)
    {
        if(is_object($db))
        {
            $this->_db = $db;
        }
        else
        {
            $dsn = "mysql:host=".DB_HOST.";dbname=".DB_NAME;
            $this->_db = new PDO($dsn, DB_USER, DB_PASS);
        }
    }

	 public function display()
    {
		$sql = $this->_db->query("SELECT count(*) as theCount FROM equipments") ;
		$row=$sql->fetchColumn();
	    if($row ==0 ) {
                echo "
 Error
"
                    . "
 No equipments added."
                    . "Add another equipment.
";
				return;
		}/*gets the number of equipments in the table*/

		/*Ok so here what I do is display equipments dynamically. For this I query my db and then generate the output row as div(s). Three images were required in a row so i did that and added a row break as required */
        if($sql = $this->_db->query("SELECT * FROM equipments")) {
            try{
			$i=0;
			$sql->setFetchMode(PDO::FETCH_ASSOC);
			while($row = $sql->fetch()){
				$eid=$row['id'];
				$name=$row['name'];
				$img=$row['image'];
				$desc=$row['description'];
				if($i%3==0)
				{
				echo '
';
				}

				echo
						'<form role="form" action="test.php" method="post">
'
							.''
							.'<input type="image" class="img-responsive" src="'.$img.'" alt="Sorry! Can\'t load the image ">'
							.'
'.$name.'
'
							.'
'
							.'Description........................ '.$desc
							.'
'
							.'<input id="ename" name="ename" type="hidden" value="'.$name.'">'
							.'<input id="eid" name="eid" type="hidden" value="'.$eid.'">'
						.'
</form>';
				if(($i+1)%3==0)
				{
				echo "
";
				}

				$i++;
			}
			} catch(PDOException $e) {echo "
".$e->getMessage()."
";
				echo "
 Error

 Couldn't fetch from "
                . "equipment information into the database.
";
				return;
				}
			}
        else {
            return "
 Error

 Couldn't insert the "
                . "user information into the database.
";
        }
	}

	function close(){$this->_db=null;}

}

?><file_sep><?php
include_once('/inc/core.inc.php');
if(isset ($_SESSION['user_id'])&&isset ($_SESSION['ename']))
{
include_once ("/common/head.php");
include_once ("/common/navbar_top_side.php");
?>

<?php
	if(isset ($_POST['starttime'])&&isset ($_POST['endtime'])&&isset ($_POST['startdate'])&&!empty($_POST['startdate'])&&!empty($_POST['endtime'])&&!empty($_POST['starttime']))
	{	$id=$_SESSION['user_id']['id'];
		$eid=$_SESSION['eid'];
		$username=$_SESSION['user_id']['id'];
		$date=$_POST['startdate'];
		$start= $_POST['starttime'];
		list($start_hr, $start_min, $start_sec) = explode(":", $start);
		echo"start: hr=".$start_hr."\tmin=".$start_min."\tsec=".$start_sec;
		$end= $_POST['endtime'];
		list($end_hr, $end_min, $end_sec) = explode(":", $end);
		echo"\n end: hr=".$end_hr."\tmin=".$end_min."\tsec=".$end_sec;
		list($date_day, $date_mon, $date_year) = explode("-", $date);
		$date=$date_year.'-'.$date_mon.'-'.$date_day;
		echo "date=".$date;
		$date_day=intval($date_day);
		$date_mon=intval($date_mon);
		$date_year=intval($date_year);
		echo"\n date: day=".$date_day."\tmon=".$date_mon."\tyear=".$date_year;
		$start_hr=intval($start_hr);
		$start_min=intval($start_min);
		$start_sec=intval($start_sec);
		$end_hr =intval($end_hr);
		$end_min=intval($end_min);
		$end_sec=intval($end_sec);

		$stime=mktime($start_hr,$start_min,$start_sec,$date_mon,$date_day,$date_year);
		$etime=mktime($end_hr,$end_min,$end_sec,$date_mon,$date_day,$date_year);

		echo"Starttime:".$stime."\tEndtime: ".$etime;
		$sql = "INSERT INTO `ers`.`bookings` (`date`, `starttime`, `endtime`, `userid`, `eid`) VALUES (?,?,?,?,?)";
		$stmt=$db->prepare($sql);
		$result=$stmt->execute(array($date,date('Y-m-d H:i:s',$stime),date('Y-m-d H:i:s',$etime),$id,$eid));
		if($result)
			{
			echo "Success! Ypur booking has been made.Go Back";
			unset($_SESSION['eid'],$_SESSION['ename'],$_SESSION['sdate']);
			}
		else
			{
			echo "Error! Something went wrong.Please try again!";
			}

	}
	else
	echo "Sorry it appears the data sent has not been recived.Please try again";
?>
<?php
include_once ("/common/close.php");}
else
header ('login.php');
?><file_sep><?php

require_once '/inc/core.inc.php';
include_once ("/common/head.php");
<<<<<<>>>>>> origin/mybranch
$userid=$_SESSION['user_id'];
$type=$_SESSION['usertype'];
include_once ("/common/navbar_top_side.php");
?>

New User Requests

	<form action="cancel.php" method="POST">
<?php
			if($type=="user")
			{$sql= "select * from bookings where userid=? ";}
			elseif($type=="admin")
			{$sql= "select * from adminbookings where userid=? ";}

			$stmt=$db->prepare($sql);
<<<<<<execute(array($userid['id']));
=======
			$qresult=$stmt->execute(array($userid));
>>>>>>> origin/mybranch
			if(!$qresult)
			{
				echo "Can't fetch the records";
			}

			echo '

Equipment Name	Date	Start Time	End Time	Check to Remove
';
			while ($results =$stmt->fetch()){

			$id=$results['id'];
			$sql2= "select name from equipments where id=:in";
			$stmt2=$db->prepare($sql2);
			$stmt2->bindParam(':in',$id,PDO::PARAM_INT);
			$qresult=$stmt2->execute();
			$r_name=$stmt2->fetch();
			$name=$r_name[0];
			$date=$results['date'];
			$start=$results['starttime'];
			$end=$results['endtime'];

			//$img=$results['img'];
			?>

			<?php
					echo '
'.$name.'	'.$date.'	'.$start.'	'.$end.'	<input type="checkbox" name="check_list[]" value='.$id.'>
';
			?>

		<?php } ?>

			<button class=".btn-important" type="submit">Cancel Selected Bookings</button>

		</form>

<?php
include_once("/common/close.php");
}
else
header ("Location: login.php");
?><file_sep>(function($) {

	"use strict";

	var options = {
		events_source: 'feedevent.php',
		view: 'month',
		tmpl_path: 'tmpls/',
		tmpl_cache: false,
		day: 'now',
		onAfterEventsLoad: function(events) {
			if(!events) {
				return;
			}
			var list = $('#eventlist');
			list.html('');

			$.each(events, function(key, val) {
				$(document.createElement('li'))
					.html('' + val.title + '')
					.appendTo(list);
			});
		},
		onAfterViewLoad: function(view) {
			$('.page-header #head').text(this.getTitle());
			$('.btn-group button').removeClass('active');
			$('button[data-calendar-view="' + view + '"]').addClass('active');

				if(this.options.view =='day'){
				var data=$(".page-header #head").text();
				var array=data.split(' ');
				var day=array[1];
				var finalday;
				if((day=='0')||(day=='1')||(day=='2')||(day=='3')||(day=='4')||(day=='5')||(day=='6')||(day=='7')||(day=='8')||(day=='9'))
					{finalday='0'+day;}
				else
					{finalday=day;}
				var month=array[2].split(',');
				var m='00';
				if(month[0]=='January')
					{ m='01';}
				else if(month[0]=='February')
					{ m='02';}
				else if(month[0]=='March')
					{ m='03';}
				else if(month[0]=='April')
					{ m='04';}
				else if(month[0]=='May')
					{ m='05';}
				else if(month[0]=='June')
					{ m='06';}
				else if(month[0]=='July')
					{ m='07';}
				else if(month[0]=='August')
					{ m='08';}
				else if(month[0]=='September')
					{ m='09';}
				else if(month[0]=='October')
					{ m='10';}
				else if(month[0]=='November')
					{ m='11';}
				else if(month[0]=='December')
					{ m='12';}
				else
					window.console('-1');

				var final=finalday+"-"+m+"-"+array[3];
				//alert('date:'+final);
				$("#sdate").val(final);
				}

		},
		classes: {
			months: {
				general: 'label'
			}
		}
	};

	var calendar = $('#calendar').calendar(options);

	$('.btn-group button[data-calendar-nav]').each(function() {
		var $this = $(this);
		$this.click(function() {
			calendar.navigate($this.data('calendar-nav'));
		});
	});

	$('.btn-group button[data-calendar-view]').each(function() {
		var $this = $(this);
		$this.click(function() {
			calendar.view($this.data('calendar-view'));
		});
	});

	$('#first_day').change(function(){
		var value = $(this).val();
		value = value.length ? parseInt(value) : null;
		calendar.setOptions({first_day: value});
		calendar.view();
	});

	$('#language').change(function(){
		calendar.setLanguage($(this).val());
		calendar.view();
	});
	$('#events-in-modal').change(function(){
		var val = "#events-modal";
		calendar.setOptions({modal: val});
	});
	$('#events-modal .modal-header, #events-modal .modal-footer').click(function(e){
		//e.preventDefault();
		//e.stopPropagation();
	});
}(jQuery));<file_sep><!DOCTYPE php>
<?php
require_once '/inc/core.inc.php';
if(isset($_SESSION['user_id'])&&!empty($_SESSION['user_id']))
{   $flag=0;
	if(isset($_POST['ename'])&&!empty($_POST['ename'])&&isset($_POST['description'])&&!empty($_POST['description']))
	{
		//temporary solution for image problem permanent in next iteration`

		$sql = "SELECT max(`id`) AS maxid FROM `equipments`";
        $stmt=$db->prepare($sql);
		$result=$stmt->execute();
		if(!$result)
			$flag=3;
		$result_name=$stmt->fetch();
		$img="/img/equip/".($result_name[0]+1).".jpg";

		$name=$_POST['ename'];
		$desc=$_POST['description'];

		$sql2="INSERT INTO `equipments`( `name`, `description`, `image`) VALUES ?,?,?";
		$stmt2=$db->prepare($sql2);
		/*$stmt2->bindParam(':name',$name,PDO::PARAM_STR);
		$stmt2->bindParam(':desc',$desc,PDO::PARAM_STR);
		$stmt2->bindParam(':img',$img,PDO::PARAM_STR);*/
		$result2=$stmt2->execute(array($name,$desc,$img));
		if($result2)
			$flag=1;
		else
			$flag=2;
	}
	include_once("/common/head.php");
    include_once("/common/navbar_top_side.php");
?>

                            Add Equipment

				<?php
					if($flag==1)
					echo '
 Success! New element added succesfully
								<button type="button" class="close" data-dismiss="alert" aria-hidden="true">
								×
								</button>

';
					elseif($flag==2)
<<<<<<< HEAD
					echo	'
Error! Could not insert '.
							$_POST["description"].'	<button type="button" class="close" data-dismiss="alert" aria-hidden="true">
=======
					echo	'
Error! Could not insert
								<button type="button" class="close" data-dismiss="alert" aria-hidden="true">
>>>>>>> origin/mybranch
								×
								</button>

';
					elseif($flag==3)
					echo	'
 Error! New equipment could not be added because old data was not fetched
								<button type="button" class="close" data-dismiss="alert" aria-hidden="true">
								×
								</button>

';

					else
					echo	'
 Fill the form
								<button type="button" class="close" data-dismiss="alert" aria-hidden="true">
								×
								</button>

';
				?>

				<form method="POST" action="addequipment.php">

<<<<<<< HEAD
    					Equipment Name
=======
    					Equipment Name
>>>>>>> origin/mybranch
    					<input type="text" class="form-control" name="ename">

    					Equipment Description
<<<<<<< HEAD
    					<input class="form-control" rows="3" name="description"></input>
=======
    					<textarea class="form-control" rows="3" name="description"></textarea>
>>>>>>> origin/mybranch

  					<button type="submit" class="btn btn-default">Submit</button>
				</form>

<?php
   include_once("/common/close.php");
	}

else{
	 header ('Location:login.php');
	}
?><file_sep><?php
require_once '/inc/core.inc.php';
if( isset($_POST['username']) && isset($_POST['password'])&&isset($_POST['usertype'])){
$username=$_POST['username'];
$password=$_POST['<PASSWORD>'];
$type=$_POST['usertype'];
$_SESSION['usertype']=$type;
				if(!empty($username)&&!empty($password)&&!empty($type))
				{
					if($type=="user")
					{
						$query_run1=$db->query("select count(*) as theCount from users where name ='$username' and password ='$password'");
						$count=$query_run1->fetchColumn();
					}
					elseif($type=="admin")
					{
						$query_run1=$db->query("select count(*) as theCount from admin where name ='$username' and password ='$<PASSWORD>'");
						$count=$query_run1->fetchColumn();
					}
					else
						{echo "";}

					if($count == 1){
									 if($type=="user")
									 {
									 $stmt=$db->prepare("select * from users where name =? and password =?");
									 $result=$stmt->execute(array($username,$password));
									 }

									 if($type=="admin")
									 {
									 $stmt=$db->prepare("select * from admin where name =? and password =?");
									 $result=$stmt->execute(array($username,$password));
									 }
									 if($result)
									 {
									$userid= $stmt->fetch();
									$_SESSION['user_id']=$userid; //['id'];
									//$_SESSION['username']=$userid['name'];

									header('Location:index.php');
									}
									}
					else
									echo"";
				}
		else{
		 echo'

		 ';
		}
}
/*else{
	echo'

	 ';
	}*/
?>

<!DOCTYPE html>

    <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>Login</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">

    <link href="css/grayscale.css" rel="stylesheet">

    <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="http://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic" rel="stylesheet" type="text/css">
    <link href="http://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">

IIT-INDORE

Welcome to
Equipment reservation system.

Move down to Login

SignIn to reserve an equipment

                        <form role="form" action="login.php" method="POST">

Username

                                <input class="form-control" placeholder="xyz120001001" name="username">

Password

                                <input class="form-control" type="password" placeholder="********" name="password">

I am
								<select name="usertype">
                                <option class="form-control" name="usertype" value="admin">Admin</option>
								<option class="form-control" name="usertype" value="user">User</option>
								</select>

                            <button type="submit" class="btn btn-default">Submit</button>

                        </form>

Not Signed Up...SignUp Now

Copyright © Your Website 2014

<file_sep><?php
include_once('/inc/core.inc.php');
<<<<<<>>>>>> origin/mybranch
$userid=$_SESSION['user_id'];
$type=$_SESSION['usertype'];
if(!empty($_POST['check_list'])){
// Loop to store and display values of individual checked checkbox.
$flag=0;
foreach($_POST['check_list'] as $selected){
		echo $selected."
";
		if($type=="user")
		$sql="DELETE FROM `bookings` WHERE `id`= :in and `userid`=:user";
		elseif($type=="admin")
		$sql="DELETE FROM `adminbookings` WHERE `id`= :in and `userid`=:user";

		$stmt=$db->prepare($sql);
		$stmt->bindParam(':in',$selected,PDO::PARAM_INT);
<<<<<<bindParam(':user',$userid['id'],PDO::PARAM_INT);
=======
		$stmt->bindParam(':user',$userid,PDO::PARAM_INT);
>>>>>>> origin/mybranch
		$result=$stmt->execute();
		if(!$result)
			{$flag=1;}
		$stmt->closeCursor();
	}

		if($flag==1)
		echo"Error! Deletion was not done successfully";
		else
		{
			$db=null;
			echo"Deletion done successfully";
<<<<<<>>>>>> origin/mybranch
		}
	}
	else
	header("Location: cancelbooking.php");
}
else
	header("Location: login.php");
?><file_sep><?php
require_once "/inc/core.inc.php";
if(isset($_SESSION['user_id'])&&!empty($_SESSION['user_id'])){
$user_id=$_SESSION['user_id'];
$ename=$_POST['ename'];
$ename=$_SESSION['ename'];
if(isset($_POST['sdate']))
$sdate=$_POST['sdate'];
else
$sdate=$_SESSION['sdate'];

$_SESSION['sdate']=$sdate;
include_once ("/common/head.php");
include_once ("/common/navbar_top_side.php");
?>

Perform Booking

	<form name="myForm" role="form" method="POST" action="booking2.php">

		Name:<input type="text" id ="name" value="<?php echo $user_id['name'];?>" readonly></input>

		Equipment Name:<input type="text" name="ename" value="<?php echo $ename;?>"readonly></input>

		Start Date:<input type="text" name="startdate" value="<?php echo $sdate;?>"></input>

		Start Time:<input type="text" name="starttime" placeholder="hh:mm:ss"></input>

		End Time:<input type="text" name="endtime" placeholder="hh:mm:ss"></input>

		<button class=".btn-success" type="submit">Book It!</button>
	</form>

<?php
include_once ("/common/close.php");}
else
{
  include 'login.php';
}
?><file_sep>-- phpMyAdmin SQL Dump
-- version 4.1.14
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Mar 26, 2015 at 01:59 PM
-- Server version: 5.6.17
-- PHP Version: 5.5.12

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `ers`
--

-- --------------------------------------------------------

--
-- Table structure for table `addusers`
--

CREATE TABLE IF NOT EXISTS `addusers` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `password` varchar(500) NOT NULL,
  `email` varchar(100) DEFAULT NULL,
  `photo` varchar(200) DEFAULT NULL,
  `tempaddress` text,
  `peraddress` text,
  `phoneno` varchar(10) DEFAULT NULL,
  `rollno` varchar(9) DEFAULT NULL,
  PRIMARY KEY (`id`,`name`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;

--
-- Dumping data for table `addusers`
--

INSERT INTO `addusers` (`id`, `name`, `password`, `email`, `photo`, `tempaddress`, `peraddress`, `phoneno`, `rollno`) VALUES
(1, 'phd1000001', 'iit', '<EMAIL>', NULL, NULL, NULL, NULL, '1000001'),
(3, 'anant', 'iit', '<EMAIL>', NULL, NULL, NULL, NULL, '10000004');

-- --------------------------------------------------------

--
-- Table structure for table `admin`
--

CREATE TABLE IF NOT EXISTS `admin` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `password` varchar(500) NOT NULL,
  `emailid` varchar(100) DEFAULT NULL,
  `photo` varchar(200) DEFAULT NULL,
  `tempaddress` text,
  `peraddress` text,
  `phoneno` varchar(10) DEFAULT NULL,
  `rollno` varchar(9) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

--
-- Dumping data for table `admin`
--

INSERT INTO `admin` (`id`, `name`, `password`, `emailid`, `photo`, `tempaddress`, `peraddress`, `phoneno`, `rollno`) VALUES
(1, 'vipul', 'iit', '<EMAIL>', '/img/admin/1', '1', '1', '100001011', NULL);

-- --------------------------------------------------------

--
-- Table structure for table `adminbookings`
--

CREATE TABLE IF NOT EXISTS `adminbookings` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `date` date NOT NULL,
  `starttime` timestamp NOT NULL,
  `endtime` timestamp NOT NULL,
  `userid` int(11) NOT NULL,
  `eid` int(11) NOT NULL,
  PRIMARY KEY (`id`,`userid`,`eid`),
  KEY `userid` (`userid`),
  KEY `eid` (`eid`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

--
-- Dumping data for table `adminbookings`
--

INSERT INTO `adminbookings` (`id`, `date`, `starttime`, `endtime`, `userid`, `eid`) VALUES
(1, '2015-03-27', '2015-03-27 09:19:34', '2015-03-27 14:19:34', 1, 1);

-- --------------------------------------------------------

--
-- Table structure for table `bookings`
--

CREATE TABLE IF NOT EXISTS `bookings` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `date` date NOT NULL,
  `starttime` timestamp NOT NULL,
  `endtime` timestamp NOT NULL,
  `userid` int(11) NOT NULL,
  `eid` int(11) NOT NULL,
  PRIMARY KEY (`id`,`userid`,`eid`),
  KEY `bookings_ibfk_2` (`eid`),
  KEY `bookings_ibfk_1` (`userid`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;

--
-- Dumping data for table `bookings`
--

INSERT INTO `bookings` (`id`, `date`, `starttime`, `endtime`, `userid`, `eid`) VALUES
(2, '2015-03-17', '2015-03-17 14:01:33', '2015-03-17 17:01:33', 1, 2),
(3, '2015-03-17', '2015-03-18 14:04:35', '2015-03-18 16:04:35', 1, 3),
(4, '2015-03-25', '2015-03-25 17:55:06', '2015-03-25 17:55:06', 2, 1),
(7, '2015-03-12', '2015-03-12 05:15:50', '2015-03-12 09:50:25', 1, 1),
(8, '2015-03-27', '2015-03-27 05:15:50', '2015-03-27 09:50:25', 1, 1),
(9, '2015-03-28', '2015-03-28 05:15:50', '2015-03-28 09:50:25', 1, 2);

-- --------------------------------------------------------

--
-- Table structure for table `equipments`
--

CREATE TABLE IF NOT EXISTS `equipments` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `description` longtext NOT NULL,
  `image` varchar(100) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;

--
-- Dumping data for table `equipments`
--

INSERT INTO `equipments` (`id`, `name`, `description`, `image`) VALUES
(1, 'equip1', '', '/img/equip/1.jpg'),
(2, 'equip2', '', '/img/equip/2.jpg'),
(3, 'equipment3', '', '/img/equip/3.jpg'),
(4, 'equipment4', '', '/img/equip/4.jpg');

-- --------------------------------------------------------

--
-- Table structure for table `events`
--

CREATE TABLE IF NOT EXISTS `events` (
  `datetime` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `events`
--

INSERT INTO `events` (`datetime`) VALUES
('2015-02-08 14:54:35'),
('1970-01-01 05:30:00');

-- --------------------------------------------------------

--
-- Table structure for table `users`
--

CREATE TABLE IF NOT EXISTS `users` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `password` varchar(500) NOT NULL,
  `email` varchar(100) DEFAULT NULL,
  `photo` varchar(200) DEFAULT NULL,
  `tempaddress` text,
  `peraddress` text,
  `phoneno` varchar(10) DEFAULT NULL,
  `rollno` varchar(9) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`id`, `name`, `password`, `email`, `photo`, `tempaddress`, `peraddress`, `phoneno`, `rollno`) VALUES
(1, 'hursh', 'iit', '<EMAIL>', '/img/user/1', '127', '123', '900909090', '100000001'),
(2, 'manish', 'iit', '<EMAIL>', '/img/user/2', '1231', '111', '000999000', '100000002'),
(3, 'simmi', 'iit', '<EMAIL>', NULL, NULL, NULL, '9999999999', '100000003'),
(6, 'anant', 'iit', '<EMAIL>', NULL, NULL, NULL, NULL, '10000004'),
(7, 'anant', 'iit', '<EMAIL>', NULL, NULL, NULL, NULL, '10000004');

--
-- Constraints for dumped tables
--

--
-- Constraints for table `adminbookings`
--
ALTER TABLE `adminbookings`
  ADD CONSTRAINT `adminbookings_ibfk_2` FOREIGN KEY (`eid`) REFERENCES `equipments` (`id`),
  ADD CONSTRAINT `adminbookings_ibfk_1` FOREIGN KEY (`userid`) REFERENCES `admin` (`id`);

--
-- Constraints for table `bookings`
--
ALTER TABLE `bookings`
  ADD CONSTRAINT `bookings_ibfk_1` FOREIGN KEY (`userid`) REFERENCES `users` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `bookings_ibfk_2` FOREIGN KEY (`eid`) REFERENCES `equipments` (`id`) ON UPDATE CASCADE;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
<file_sep>

<form method="post" action="editprofile.php">
Username:
<input type ="text" name = "username">

Password :
<input type ="password" name = "password">

Temp. Address :
<textarea row ="15"  cols "50" name = "address"></textarea>

Phone No :
<input type ="text" name = "phone">

Email ID :
<input type ="text" name = "email">

Date of Birth :
<input type ="text" name = "DOB">

<input type ="submit" value = "Submit">
</form>

<file_sep><?php
include_once('/inc/connect.inc.php');
if(!empty($_POST['check_list'])){
// Loop to store and display values of individual checked checkbox.
$flag=0;
foreach($_POST['check_list'] as $selected){
echo $selected."
";
		$sql="SELECT * FROM `addusers` WHERE `id`= :in";
		$stmt=$db->prepare($sql);
		$stmt->bindParam(':in',$selected,PDO::PARAM_INT);
		$result=$stmt->execute();
		if(!$result)
			{$flag=1;}
		else
			{
			$row=$stmt->fetch();
			$sql2="INSERT INTO `users`(`name`, `password`, `email`, `photo`, `tempaddress`, `peraddress`, `phoneno`, `rollno`) VALUES (:name,:pass,:email,:photo,:tempaddress,:peraddress,:phone,:roll)";
			$stmt2=$db->prepare($sql2);
			$stmt2->bindParam(':name',$row['name'],PDO::PARAM_STR);
			$stmt2->bindParam(':pass',$row['password'],PDO::PARAM_STR);
			$stmt2->bindParam(':email',$row['email'],PDO::PARAM_STR);
			$stmt2->bindParam(':photo',$row['photo'],PDO::PARAM_STR);
			$stmt2->bindParam(':tempaddress',$row['tempaddress'],PDO::PARAM_STR);
			$stmt2->bindParam(':peraddress',$row['peraddress'],PDO::PARAM_STR);
			$stmt2->bindParam(':phone',$row['phoneno'],PDO::PARAM_STR);
			$stmt2->bindParam(':roll',$row['rollno'],PDO::PARAM_STR);
			$result2=$stmt2->execute();
			if(!$result2)
				$flag=2;
			else
				$stmt2->closeCursor();
			}
		$stmt->closeCursor();
	}

if($flag==1)
echo"Error! Selection was not done successfully";
elseif($flag==2)
echo"Error! Insertion was not done successfully";
else
{$db=null;
echo"Insertion done successfully";}
header("Location: allusers.php");

}
else
	header("Location: cancelbooking.php");
?><file_sep>

    <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>IIT INDORE EQUIPMENT RESERVATION SYSTEM
	</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">

   <link href="css/sb-admin.css" rel="stylesheet">

    <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">

	<link rel="stylesheet" href="css/calendar.css">

                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                    Toggle navigation

                </button>
                IIT INDORE

                      User Name

                             Profile

                             Settings

                             Log Out

                         Equipments

                         All Users

                         Add user

                         Add equipment

                         Cancel Booking

Perform Booking

	<form name="myForm" role="form" action="booking2.php" method="POST">

		Name:<input type="text" id ="name" value="hursh" readonly></input>

		Equipment Name:<input type="text" id ="ename" value="equip1"readonly></input>

		Start Date:<input type="date" id ="sdate" value=""readonly></input>

		Start Time:<input type="text" id ="starttime" name="starttime" placeholder="hh:mm:ss"></input>

		End Time:<input type="text" id ="endtime" name="endtime" placeholder="hh:mm:ss"></input>

		<input type="hidden" id ="end" name="end"></input>
		<input type="hidden" id ="start" name="start"></input>
		<button class=".btn-success" type="submit">Book It!</button>
	</form>

<file_sep><file_sep><?php

require '/inc/core.inc.php';
if(isset($_SESSION['user_id'])&&!empty($_SESSION['user_id']))
{  $user_id=$_SESSION['user_id'];
?>

                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                    Toggle navigation

                </button>
                IIT INDORE

                    <?php echo $user_id['name'];?>

                             Profile

                             Settings

                             Log Out

                    <?php
						if($_SESSION['usertype']=='admin'){
					?>

                         Equipments

                         All Users

                         Add user

                         Add equipment

                         Cancel Booking

                        Search

					<?php
						}
						else if($_SESSION['usertype']=='user'){
					?>

                         Equipments

                         Cancel Booking

                        Search

					<?php } ?>

<?php
}

else{
	  include('login.php');
}
?>
<file_sep><?php
include_once("common/base.php");
$pagetitle="addaccount";
include_once("common/head.php");
include_once("common/navbar_top_side.php");
?>

<?php
	$sql="SELECT * from addusers";
	try{$stmt=$db->query($sql);}
	catch(PDOException $e) {echo "
ERROR: ".$e->getMessage()."
";}
?>

		Name
		Roll No.

<?php

	while($row = $stmt->fetch(PDO::FETCH_ASSOC)){
		echo "

".$row['name']."	".$row['rollno']."
";
            }

?>

<?php
include_once("common/close.php");
?>

<file_sep><?php

    // Database credentials
    define('DB_HOST', 'localhost');
    define('DB_USER', 'root');
    define('DB_PASS', '');            // It defines 'DB_PASS' as Database "Password" which is null here;
    define('DB_NAME', 'ers');       // It defines 'DB_NAME' as Database name;
?><file_sep><?php

	/*$DB_HOST='localhost';
    $DB_USER='root';
    $DB_PASS='';
    $DB_NAME='login';
    $link=mysqli_connect('localhost','root','','login') or die('could not connect');
    @mysqli_select_db($DB_NAME);  //selecting database
	echo "connected
";*/

	// Database credentials
    /*define('DB_HOST', 'localhost');
    define('DB_USER', 'root');
    define('DB_PASS', '');            // It defines 'DB_PASS' as Database "Password" which is null here;
    define('DB_NAME', 'ers');       // It defines 'DB_NAME' as Database name;

	$link=mysqli_connect($DB_HOST,$DB_USER,$DB_PASS,$DB_NAME) or die('could not connect');  //it makes a connection tothe database using hostname,user,password and db name
    //else it terminates the page at this point stating 'couldnt connect'*/

	// Include site constants
    include_once "inc/constants.inc.php";

    // Create a database object                        // Try_Catch both - gives us the ability to use Exceptions,
	                                                   //which help improve error handling.
    try {
	$dsn = "mysql:host=".DB_HOST.";dbname=".DB_NAME;
        $db = new PDO($dsn, DB_USER, DB_PASS);
    } catch (PDOException $e) {
        echo '
Connection failed: ' . $e->getMessage().'
';  // If BD connection fails, it will display
                                                        // a message like here "Connection failed"
        exit;
    }

?><file_sep><?php

require '/inc/core.inc.php';
require '/inc/connect.inc.php';

if(isset($_SESSION['user_id'])&&!empty($_SESSION['user_id']))
<<<<<<prepare($sql);
				  $query->execute(array($name,$id));
				  $user_id['name']=$name;
				  $_SESSION['user_id']['name']=$name;
		}
	}
	 if(isset($_POST['password'])&&!empty($_POST['password'])){
	$password=$_POST['password'];
	$id=$user_id['id'];
	 if($_POST['password']!=$user_id['password']){
				if($_SESSION['usertype']=="admin")
				$sql = "update admin set password=? where id=?";
				elseif($_SESSION['usertype']=="user")
				$sql = "update users set password=? where id=?";
				  $query = $db->prepare($sql);
				  $query->execute(array($password,$id));
				  $user_id['password']=$password;
				  $_SESSION['user_id']['password']=$password;
		}
	}
	 if(isset($_POST['email'])&&!empty($_POST['email'])){
	$email=$_POST['email'];
	$id=$user_id['id'];
	 if($_POST['email']!=$user_id['email']){
				if($_SESSION['usertype']=="admin")
				$sql = "update admin set email=? where id=?";
				elseif($_SESSION['usertype']=="user")
				$sql = "update users set email=? where id=?";
				  $query = $db->prepare($sql);
				  $query->execute(array($email,$id));
				  $user_id['email']=$email;
				  $_SESSION['user_id']['email']=$email;
		}
	}
	 if(isset($_POST['phoneno'])&&!empty($_POST['phoneno'])){
	$phoneno=$_POST['phoneno'];
	$id=$user_id['id'];
	 if($_POST['phoneno']!=$user_id['phoneno']){
				if($_SESSION['usertype']=="admin")
				$sql = "update admin set phoneno=? where id=?";
				elseif($_SESSION['usertype']=="user")
				$sql = "update users set phoneno=? where id=?";
				  $query = $db->prepare($sql);
				  $query->execute(array($phoneno,$id));
				  $user_id['phoneno']=$phoneno;
				  $_SESSION['user_id']['phoneno']=$phoneno;
		}
	}
	 if(isset($_POST['tempadd'])&&!empty($_POST['tempadd'])){
	$tempadd=$_POST['tempadd'];
	$id=$user_id['id'];
	 if($_POST['tempadd']!=$user_id['tempaddress']){
				if($_SESSION['usertype']=="admin")
				$sql = "update admin set tempaddress=? where id=?";
				elseif($_SESSION['usertype']=="user")
				$sql = "update users set tempaddress=? where id=?";
				  $query = $db->prepare($sql);
				  $query->execute(array($tempadd,$id));
				  $user_id['tempaddress']=$tempadd;
				  $_SESSION['user_id']['tempaddress']=$tempadd;
		}
	}
	 if(isset($_POST['peradd'])&&!empty($_POST['peradd'])){
	$peradd=$_POST['peradd'];
	$id=$user_id['id'];
	 if($_POST['peradd']!=$user_id['peraddress']){
				if($_SESSION['usertype']=="admin")
				$sql = "update admin set peraddress=? where id=?";
				elseif($_SESSION['usertype']=="user")
				$sql = "update users set peraddress=? where id=?";
				  $query = $db->prepare($sql);
				  $query->execute(array($peradd,$id));
				  $user_id['peraddress']=$peradd;
				  $_SESSION['user_id']['peraddress']=$peradd;
		}
	 }
	 if(isset($_POST['rollno'])&&!empty($_POST['rollno'])){
	$rollno=$_POST['rollno'];
	$id=$user_id['id'];
	 if($_POST['rollno']!=$user_id['rollno']){
				if($_SESSION['usertype']=="admin")
				$sql = "update admin set rollno=? where id=?";
				elseif($_SESSION['usertype']=="user")
				$sql = "update users set rollno=? where id=?";
				  $query = $db->prepare($sql);
				  $query->execute(array($rollno,$id));
				  $user_id['rollno']=$rollno;
				  $_SESSION['user_id']['rollno']=$rollno;
	 }
}
=======
{    echo "hello!!";
    $user_id=$_SESSION['user_id'];
>>>>>>> origin/mybranch
	include_once("/common/head.php");

       include_once("/common/navbar_top_side.php");
?>

                             General Account Settings

<<<<<<< HEAD

				 <form method="POST" action="settings.php">

    					Username
						<input name="name" value="<?php echo $user_id['name'];?>"></input>
						<button type="submit">EDIT</button>

					</form>
					<form method="POST" action="settings.php">

    					Password
						<input name="password" value="<?php echo $user_id['password'];?>"></input>
						<button type="submit">EDIT</button>

					</form>
					<form method="POST" action="settings.php">

    					Email address
						<input name="email" value="<?php echo $user_id['email'];?>" ></input>
						<button type="submit">EDIT</button>

					</form>
					<form method="POST" action="settings.php">

    					Temporary address
						<input name="tempadd" value="<?php echo $user_id['tempaddress'];?>" ></input>
						<button type="submit">EDIT</button>

					</form>
					<form method="POST" action="settings.php">

    					Permanent address
						<input name="peradd" value="<?php echo $user_id['peraddress'];?>" ></input>
						<button type="submit">EDIT</button>

					</form>
					<form method="POST" action="settings.php">

    					Ph No
						<input name="phoneno" value="<?php echo $user_id['phoneno'];?>" ></input>
						<button type="submit">EDIT</button>

					</form>
					<form method="POST" action="settings.php">

    					Roll No
						<input name="rollno" value="<?php echo $user_id['rollno'];?>" ></input>
						<button type="submit">EDIT</button>

					</form>

=======
				<form>

    					Username
						<?php echo $user_id['name'];?>EDIT

    					Password
    					<?php echo $user_id['password'];?><button>EDIT</button>

    					Email address
    					<?php echo $user_id['email'];?><button>EDIT</button>

    					Temporary address
    					<?php echo $user_id['tempaddress'];?><button>EDIT</button>

    					Permanent address
    					<?php echo $user_id['peraddress'];?><button>EDIT</button>

    					Ph No
    					<?php echo $user_id['phoneno'];?><button>EDIT</button>

    					Roll No
    					<?php echo $user_id['rollno'];?><button>EDIT</button>

    					Change Photo
    					<input type="file" id="exampleInputFile">

Browse a photo from your files.

				</form>
>>>>>>> origin/mybranch

				<?php
				/* function fun1()
				 {
				   $_SESSION['edit_name']=$user_id['name'];
<<<<<<>>>>>> origin/mybranch
				 }
				 if($_GET['button1']){fun1();}*/
				?>

        ';

<?php    include_once("/common/close.php");
}

else{
  include 'login.php';
}
?><file_sep><?php
    include_once "common/base.php";
    $pagetitle = "Register";                               // This is just for the "Title" of the page
    include_once "common/head.php";
	?>

					<form class="form" method="post" action="signup.php" id="registerform">

Username&nbsp
                                <input class="form-control" name="username" placeholder="xyz120001001">

Password&nbsp <input class="form-control" name="password" type="password" placeholder="********">

Confirm Password&nbsp
                                <input class="form-control" name="confirm" type="password" placeholder="********">

Email
                                <input class="form-control" name="email" type="email" placeholder="<EMAIL>">

Roll No
                                <input class="form-control" name="rollno" type="text" placeholder="123456789">

							&nbsp&nbsp&nbsp&nbsp
							<button class="btn btn-default" type="submit">Sign Up</button>
							</form>

				<?php

				if(isset($_POST['username'])&&!empty($_POST['username'])&&isset($_POST['password'])&&!empty($_POST['password']&&isset($_POST['email'])&&!empty($_POST['email'])))
				{													// For checking the sign up form															// has been submitted or not

					include_once "inc/class.users.inc.php";
					$users = new users($db);                       //If submitted,then we will create a
																				//   new "Users()"
					echo $users->createAccount();                              // and "createAccount()"
				}			// which is a method will be called

				?>
				<form action="login.php">
				<button  class="btn btn-default">Go Back</button>
				</form>

<?php
include_once 'common/close.php';
?>
<file_sep><?php
include_once ("/common/base.php");
if(isset($_SESSION['eid']))
$eid=$_SESSION['eid'];
else
{echo json_encode(array('error' => 0, 'result' => 'session not set'));
}
$start = time()-(31*24*60*60);
$end   = time()+(31*24*60*60);
$sql = "SELECT * FROM `bookings` WHERE UNIX_TIMESTAMP(`starttime`) between ? and ? and eid=?";
$stmt=$db->prepare($sql);
$row=$stmt->execute(array($start,$end,$eid));

$out = array();
if($row)
while($result=$stmt->fetch()) {
	$sql2 = "SELECT name FROM `users` WHERE id=? limit 1";
	$stmt2=$db->prepare($sql2);
	$stmt2->execute(array($result['userid']));
	$name=$stmt2->fetch();

	$out[] = array(
        "id" => $result['id'],
        "title" => "Name: ".$name[0],
        "url" => "http://www.example.com/",
		"class"=> "event-important",
        "start" => (strtotime($result['starttime'])-16200).'000',
        "end" => (strtotime($result['endtime'])-16200).'000'
    );
}

$sql3 = "SELECT * FROM `adminbookings` WHERE eid=$eid and unix_timestamp(`starttime`) between ? and ? ";
$stmt4=$db->prepare($sql3);
$row4=$stmt4->execute(array($start,$end));
if($row)
while($result2=$stmt4->fetch()) {
	$sql4 = "SELECT name FROM `admin` WHERE id=? limit 1";
	$stmt5=$db->prepare($sql4);
	$stmt5->execute(array($result2['userid']));
	$adminname=$stmt5->fetch();

	$out[] = array(
        "id" => $result2['id'],
        "title" => "Name: ".$adminname[0],
        "url" => "http://www.example.com/",
		"class"=> "event-important",
        "start" => strtotime($result2['starttime']).'000',
        "end" => strtotime($result2['endtime']).'000'
    );
}
echo json_encode(array('success' => 1, 'result' => $out));
?><file_sep><?php
    // Set the error reporting level
    error_reporting(E_ALL);         // It will report each and every report occurs on our site
	                                // During Developement
    ini_set("display_errors", 1);   // It will ensure about even notices

    // Start a PHP session. .
    session_start();                // This will allow users to stay logged in when we
	                                //build that functionality later.

    // Include site constants
    include_once "inc/constants.inc.php";

    // Create a database object                        // Try_Catch both - gives us the ability to use Exceptions,
	                                                   //which help improve error handling.
    try {
	$dsn = "mysql:host=".DB_HOST.";dbname=".DB_NAME;
        $db = new PDO($dsn, DB_USER, DB_PASS);
    } catch (PDOException $e) {
        echo '
Connection failed: ' . $e->getMessage().'
';  // If BD connection fails, it will display
                                                        // a message like here "Connection failed"
        exit;
    }
?><file_sep><?php

// Set the error reporting level
    //error_reporting(E_ALL);         // It will report each and every report occurs on our site
	                                // During Developement
    //ini_set("display_errors", 1);   // It will ensure about even notices
session_start();
require 'connect.inc.php';
ob_start();//to use header functions
//have to do it for all sessions on all pages
$current_file=$_SERVER['SCRIPT_NAME'];
if(isset($_SERVER['HTTP_REFERER'])&&!empty($_SERVER['HTTP_REFERER']))
{
$http_referer=$_SERVER['HTTP_REFERER'];
}

?>

languages: Hack SQL JavaScript PHP

repo_language: Hack

repo_name: HurshTiwari/EquipmentReservationSystem


text:
<repo_name>Kevinfgn/SpaceInvaders<file_sep>/Main.java
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Frame;
import javax.swing.*;
import javax.imageio.*;
import java.net.URL;

public class Main extends JFrame {

	public static void main(String[] args) {

		Ventana window = new Ventana();

	}
}
<file_sep>/README.md
# SpaceInvaders
Proyecto 1 - Estructuras de Datos

<file_sep>/Player.java
public class Player {
	private int vida;
	private String nombre;
	private int pos_x;
	private int por_y;

	public int getVida() {
		return vida;
	}
	public void setVida(int vida) {
		this.vida = vida;
	}
	public String getNombre() {
		return nombre;
	}
	public void setNombre(String nombre) {
		this.nombre = nombre;
	}
	public int getPor_y() {
		return por_y;
	}
	public void setPor_y(int por_y) {
		this.por_y = por_y;
	}
	public int getPos_x() {
		return pos_x;
	}
	public void setPos_x(int pos_x) {
		this.pos_x = pos_x;
	}

}

languages: Java Markdown

repo_name: Kevinfgn/SpaceInvaders


text:
<repo_name>thegalah/9417_assignment<file_sep>/vocab.py
import os
import re

#load vocabulary
with open ("vocabulary.txt", "r") as myfile:
    vocab=myfile.read().strip().split('\n')

#path to training set
training_set='../20news-bydate/20news-bydate-train/'

#get list of classes
V=os.listdir(training_set)

#fix for macos
try:
	V.remove('.DS_Store')
except ValueError:
	pass

text_j=''
#foreach class V
for v in V:
	#get documents
	docs=os.listdir(training_set+v)
	#fix for macos
	try:
		docs.remove('.DS_Store')
	except ValueError:
		pass
	for doc in docs:
		doc_path=training_set+v+'/'+doc
		myfile=open(doc_path,'r')
		file_string=myfile.read()
		text_j=text_j+' '+file_string

	#remove non ascii
	text_j=re.sub(r'([^\s\w]|_)+', '', text_j)

	#substitute all whitespace with
	text_j=re.sub( '\s+', ' ', text_j ).strip().lower()

vocab=sorted(set(text_j.split(' ')))
print "\n".join(vocab)<file_sep>/README.md
# 9417_assignment
##Readme
There are two parts to the code base:

* vocab.py - generates vocabulary from the training set.
  * Training set path must be set (relative to the vocab.py script)
* learn.py - implements the algorithm described above
  * Training set path must be set (relative to the learn.py script)
  * Validation set path must be set (relative to the learn.py script)

The scripts must be invoked using `python2 vocab.py`, `python2 learn.py`
Neither of the scripts will run if there are hidden or empty directories in either the training set path
<file_sep>/learn.py
import os
import re
from math import log

#load vocabulary
with open ("vocab", "r") as myfile:
    vocab=set(myfile.read().strip().split('\n'))
vocab_length=len(vocab)

#path to training set
training_set='../20news-bydate/20news-bydate-train/'
#path to test/validation set
test_set='../20news-bydate/20news-bydate-test/'

#get list of classes
V=os.listdir(training_set)

#count number of training documents
count=0

#generate probabilities for the words in the vocab
learnings=dict();

for v in V:
	count=count+len(os.listdir(training_set+v))
#foreach class V
for v in V:
	#get documents
	docs=os.listdir(training_set+v)

	#P(v_j)
	log_doc_freq=log(len(docs))-log(count)
	text_j='';
	for doc in docs:
		doc_path=training_set+v+'/'+doc
		myfile=open(doc_path,'r')
		file_string=myfile.read()
		text_j=text_j+' '+file_string

	#clean up text
	#remove non ascii
	text_j=re.sub(r'([^\s\w]|_)+', '', text_j)

	#substitute all whitespace with
	text_j=re.sub( '\s+', ' ', text_j ).strip().lower()
	text_j=text_j.split(' ')

	#number of text positions or length
	n=len(text_j)
	print 'learning['+str(n)+']:'+v
	occurences=dict()
	for word in text_j:
		if word in occurences:
			occurences[word]+=1
		else:
			occurences[word]=1

	probabilities=dict()

	for word in vocab:
		if word in occurences:
			log_prob=log(occurences[word]+1)-log(len(occurences)+vocab_length)
		else:
			log_prob=-log(len(occurences)+vocab_length)
		log_prob+=log_doc_freq
		probabilities[word]=log_prob

	#insert probabilities into learnings
	learnings[v]=probabilities

#classify test set

#get test sets
TS=os.listdir(test_set)

doc_count=0
correct=0
for cat in TS:
	docs=os.listdir(test_set+cat)
	#classify document
	for doc in docs:
		doc_count+=1
		doc_path=test_set+cat+'/'+doc
		myfile=open(doc_path,'r')
		file_string=myfile.read()
		#clean up text
		#remove non ascii
		file_string=re.sub(r'([^\s\w]|_)+', '', file_string)

		#substitute all whitespace with
		file_string=re.sub( '\s+', ' ', file_string ).strip().lower()
		file_string=file_string.split(' ')
		max_prob=0
		probable_cat='';
		for v in V:
			p=0;
			for word in file_string:
				if word in learnings[v]:
					p+=learnings[v][word]
			if max_prob==0 or max_prob<p:
				max_prob=p
				probable_cat=v

		if probable_cat==cat:
			correct+=1
print correct,'/',doc_count,' documents were correctly classified'

languages: Markdown Python

repo_language: Markdown


text:
<repo_name>sguhl1/sguhl1.github.io<file_sep>/README.md
# sguhl1.github.io